09-07-2016 10:07 AM
How about using a Formula Node? 😛
09-07-2016 10:52 AM - edited 09-08-2016 11:57 AM
@altenbach wrote:
Maybe I should add this one to my benchmarks :o:D
OK, calculating the sum of all primes below 100M takes less than 1s for my fastest algorithm, while the regex version would take (extrapolated from the second order fit to the log-log plot) about ~212813680427 Weeks. I am not patiened enough to verify that. 😄 It is much slower than even the dumb algorithm.
(note that you need to increase the size of the upper initialzied array if you generate more polynomial terms).
09-07-2016 12:37 PM
@altenbach wrote:
[...] the regex version would take (extrapolated from the second order fit to the log-log plot) about ~212813680427 Weeks. I am not patiened enough to verify that. 😄 It is much slower than even the dumb algorithm.
Send me the program. I have a really fast computer; it can complete an endless loop in under an hour.
09-07-2016 01:17 PM
@jcarmody wrote:
@altenbach wrote:
[...] the regex version would take (extrapolated from the second order fit to the log-log plot) about ~212813680427 Weeks. I am not patiened enough to verify that. 😄 It is much slower than even the dumb algorithm.Send me the program. I have a really fast computer; it can complete an endless loop in under an hour.
But you have to run in twice 🙂
09-07-2016 01:52 PM
I probably encourage the silliness but while we are at it the Expresion Node supports the "rem" operator see here ...
...which is completely correct but totally useless.
Ben
09-07-2016 01:54 PM
I made a thread specifically for these types of questions... I got insanely busy at work and haven't kept it up, but I love fun little challenges like this. Feel free to contribute / post there 🙂
09-07-2016 02:10 PM
@jcarmody wrote:
Send me the program. I have a really fast computer; it can complete an endless loop in under an hour.
Well, it would be trivial to only look at odd numbers (except for 2) for half the number of iterations, so your endless loop would complete in 30 minutes. 😄
09-08-2016 10:01 AM
I was rading through the 2015 relesase notes when I found ...
Mathematics >>> Elementary & Special Functions >>> Discrete Math >>> Check Prime
Ben
09-08-2016 10:17 AM - edited 09-08-2016 10:18 AM
@Ben wrote:I was rading through the 2015 relesase notes when I found ...
Mathematics >>> Elementary & Special Functions >>> Discrete Math >>> Check Prime
You can look at the code and it contains an awful amount of Q&Rs 😄
Trying to find the algorithm.. (there does not seem to be a help page).
09-08-2016 10:26 AM - edited 09-08-2016 12:04 PM
@altenbach wrote:
Trying to find the algorithm.. (there does not seem to be a help page).
Looks like the prime spiral sieve.
(A wheel factorization. The main advantage is that it uses very little memory and is pretty fast for that. Takes only about 2.5 hours to sum all primes below 100M. I am sure it can be improved, though)