3 ms·
I ran the C++ version on my i7-2640M laptop (ThinkPad T420s) and got 20.394s Interestingly it is almost identical to his 2-generation newer MacBook Pro. Edit:
by bithush 11y ago
I ran the C++ version on my i7-2640M laptop (ThinkPad T420s) and got 20.394s
Interestingly it is almost identical to his 2-generation newer MacBook Pro.
Edit: and if I fix isPrime to not waste using the prime bool I get 1.862s
Edit 2: and with my horrible Java copy&paste version[0] I get 2.050s
Edit 3: ok final edit but doing squareroot(n)+1 you speed it up to 0.012s for C++ and 0.019ms for Java. Fast enough for me, good night :)
[0] https://gist.github.com/anonymous/0709e1807f57b686683f3e5f7b010558 https://gist.github.com/anonymous/0709e1807f57b686683f3e5f7b...