PumasAI | Multiple roles | REMOTE | Full-time | https://pumas.ai Pumas-AI started two years ago with a mission to modernize and improve the efficiency of predictive health analytics, and we are making rapid progress.…
Of course halving the range checked would also be an improvement. My own improvement was meant only to reduce the memory usage of antimora's code.
You can avoid allocating so much memory by changing a::Int64 = ((a%2==0) ? a : 3*a+1)/2 to a = ((a%2 == 0) ? a : 3a+1) >> 1 or a = div((a%2 == 0) ? a : 3a+1, 2) for me this gives (329, 837799) elapsed time: 0.449473338…
PumasAI | Multiple roles | REMOTE | Full-time | https://pumas.ai Pumas-AI started two years ago with a mission to modernize and improve the efficiency of predictive health analytics, and we are making rapid progress.…
Of course halving the range checked would also be an improvement. My own improvement was meant only to reduce the memory usage of antimora's code.
You can avoid allocating so much memory by changing a::Int64 = ((a%2==0) ? a : 3*a+1)/2 to a = ((a%2 == 0) ? a : 3a+1) >> 1 or a = div((a%2 == 0) ? a : 3a+1, 2) for me this gives (329, 837799) elapsed time: 0.449473338…