func ESieve(args []int) {
	cli.RequireArgs(1, "The number representing the limit is required.")

	var start, end int

	if len(args) == 1 {
		start = 2
		end = args[0]

	} else {
		start = args[0]
		end = args[1]
	}

	if start > end {
		start, end = end, start
	}

	// One is not a prime number
	if start == 1 {
		start = 2
	}

	numbers := GenPrimeNumbers(start, end)
	fmt.Println("Prime numbers:", numbers)
}
Example #2
0
func main() {
	flag.Parse()

	cli.RequireArgs(2, "You must provide 2 distinct numbers as arguments to the program")
	args := cli.IntsArgs()

	fmt.Println("Greatest common divisor is", Gcd(args[0], args[1]))
}