func main() { fib := utils.Fibgen() for i <= max { s = <-fib i, err = strconv.ParseInt(s, 10, 32) if err != nil { log.Fatal(err) } if i%2 == 0 { Σ += i } } fmt.Printf("Answer: %d\n", Σ) }
func main() { fib := utils.Fibgen() for i <= max { s = <-fib i, err = strconv.ParseInt(s, 10, 64) if err != nil { panic("Invalid num returned from fingen") } if i%2 == 0 { sum += i } } fmt.Printf("The sum of even primes which does not exceed 4,000,000 is: %d\n", sum) }