func main() { sum := uint64(2) outerloop: for i := uint64(3); i < 2000000; i = i + 2 { limit := euler.Sqrt(i) for j := uint64(3); j <= limit; j = j + 2 { if i%j == 0 { continue outerloop } } sum = sum + i } fmt.Printf("10 %d\n", sum) }
func main() { var i, j, tn, factors uint64 for factors < 500 { i++ tn = tn + i factors = 2 // tn, 1 limit := euler.Sqrt(tn) for j = 2; j <= limit; j++ { if tn%j == 0 { factors += 2 } } } fmt.Printf("12 %d\n", tn) }
func divisor_sum(n uint64) uint64 { var sum uint64 if n == 1 { return 1 } limit := euler.Sqrt(n) sum = 1 if limit*limit == n { sum = sum + limit } for i := uint64(2); i < limit; i++ { if n%i == 0 { sum = sum + i + n/i } } return sum }