Hacker News new | past | comments | ask | show | jobs | submit login

Reminds me of some code I wrote for a codeeval challenge for returning the sum of all primes up to n inclusive. IE: sum_primes(2) = 2, sum_primes(3) = 2+3 = 5 = sum_primes(4)...

It's odd that this version doesn't use a set(), but dictionary/list.

Anyway, I'll have to refactoring my code and measure against op - although I only used the python as a reference to sanity-check my naive c++ code:

https://github.com/e12e/codeeval/blob/master/4-sumprime/prim...

(I believe, like most(?) codeeval challenges, this is from project Euler)

[ed: should probably add that this isn't a sieve]




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: