@prologic@twtxt.net
In reply to: #tz4dru7nwzct
4 days ago
And just like that Problem 10 is done and correct whoohoo 🥳 It was easy because in Problem 7 I'd already written an iterator to produce infinite primes. So the solution for finding the sum of primes under 2,000,000 is basically (shortened):
primes := iter.take_while(iter.filter(prime_candidates(), is_prime), fn(p) { p < n })
print(iter.sum(primes))
And of course the answer is: 142913828922 which took ~21.ss for the Go Vm to compuete.
Timeline Sandbox