func main() { sum := 0 for i := 1; i < 1000; i++ { if misc.IsMultiple(i, 3) || misc.IsMultiple(i, 5) { sum += i } } fmt.Println(sum) }
func collatz(n int) int { if misc.IsMultiple(n, 2) { return n / 2 } else { return 3*n + 1 } }
func main() { sum := 0 for _, n := range misc.FibList(limit) { if misc.IsMultiple(n, 2) { sum += n } } fmt.Println(sum) }
func findLargestPrimeFactor(n int) int { nextPrime := misc.GetPrimesIterator(n) for prime := nextPrime(); prime > 0; prime = nextPrime() { if misc.IsMultiple(n, prime) { fmt.Println("Prime factor: ", prime) quotient := n / prime if !misc.IsPrime(quotient) { return findLargestPrimeFactor(quotient) } else { return quotient } } } return -1 }
func isLeapYear(year int) bool { return misc.IsMultiple(year, 4) && (!misc.IsMultiple(year, 100) || misc.IsMultiple(year, 400)) }