Web-apps

  • Visyounary.com
    Webapp for sharing and growing your visions together with the whole world.
  • My Home Hotel
    Webapp for booking first class rooms in and around Zürich.
  • Mike's Suchtberatung
    Webapp for providing help, support and informations about the topic drug addiction.
  • Pussi.ch
    Webapp for erotic studio pussi.ch
  • Fahrschule MF
    Webapp for driving school of Fadil Murtezi in Dübendorf.
  • MH Umzüge
    Webapp for moving company of Mitat Hyseni
  • Night shift chess
    Webapp for reporting and analyzing chess game results of my own chess club. A demo mode for login is available.
  • Art from Kim David Hauser
    Visit the art exibithion from Kim David Hauser online. Get an impression of some of my favourite own paintings.

Amicable Numbers - In GOlang. This is my version of Hello World for starting with GOlang. Cheerz!

Source-Code

package main

import "fmt"
import "math"

func main() {
	fmt.Println("#****************************************************************#")
	fmt.Println("*                                                                *")
	fmt.Println("*  AMICABLE NUMBERS version 0.0.1, (c.) by DaVe                  *")
	fmt.Println("*  2019-12-30, 21:50:06                                          *")
	fmt.Println("*                                                                *")
	fmt.Println("*  Welcome to AMICABLE NUMBERS in GO language, by kimhauser.ch   *")
	fmt.Println("*  This is a CLI program for finding amicable numbers in a       *")
	fmt.Println("*  range of Integers and print them to standard output           *")
	fmt.Println("*                                                                *")
	fmt.Println("*  https://en.wikipedia.org/wiki/Amicable_numbers                *")
	fmt.Println("*                                                                *")
	fmt.Println("*  Report any problems and feedback to This email address is being protected from spambots. You need JavaScript enabled to view it.          *")
	fmt.Println("*                                                                *")
	fmt.Println("#****************************************************************#")

	fmt.Print("Enter START number (i.e. 1): ")
	var startNum int
	fmt.Scanf("%d", &startNum)
	fmt.Print("Enter END number (i.e. 10000): ")
	var endNum int
	fmt.Scanf("%d", &endNum)

	var numList []int
	for i := startNum; i <= endNum; i++ {
		if(!contains(numList, i)){
			var quer = calcSum(i)
			if(quer != i){
				if(i == calcSum(quer)){
					numList = append(numList, quer)
					fmt.Printf("%d: %d <=> %d\n", len(numList), i, quer)
				}
			}
		}
	}
	fmt.Printf("Search finished. Found %d number(s) between %d and %d\n", len(numList), startNum, endNum)       
}

func calcSum(num int) int {
	var sum int = 1
	for i := 2; i <= int(math.Sqrt(float64(num))); i++ {
		if(math.Mod(float64(num), float64(i)) == 0){
			sum += i + (num / i)
		}
	}
	return sum
}

func contains(s []int, e int) bool {
	for _, a := range s {
		if a == e {
			return true
		}
	}
	return false
}

Console output

#****************************************************************#
*                                                                *
*  AMICABLE NUMBERS version 0.0.1, (c.) by DaVe                  *
*  2019-12-30, 21:50:06                                          *
*                                                                *
*  Welcome to AMICABLE NUMBERS in GO language, by kimhauser.ch   *
*  This is a CLI program for finding amicable numbers in a       *
*  range of Integers and print them to standard output           *
*                                                                *
*  https://en.wikipedia.org/wiki/Amicable_numbers                *
*                                                                *
*  Report any problems and feedback to This email address is being protected from spambots. You need JavaScript enabled to view it.          *
*                                                                *
#****************************************************************#
Enter START number (i.e. 1): 1
Enter END number (i.e. 10000): 10000
1: 220 <=> 284
2: 1184 <=> 1210
3: 2620 <=> 2924
4: 5020 <=> 5564
5: 6232 <=> 6368
Search finished. Found 5 number(s) between 1 and 10000

Downloads

Visyounary.com is a new concept for sharing and growing your Visions together in a global scale. Talk about ideas and visions that can create a better world for ALL of us earthlings. You deserve to have a voice and get the opportunity to be a part of the leader guilde who form our community on this planet. Start now by posting your vision to change the world, gain freedom and maybe be the next leader of a revolution. Visyounary.com beta version online Visyounary.com try it and gain freedom

Subcategories