A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is even or 3n+1 if the number is odd. See Problem 21 for more information.
Let c(n) be the sequence for n, and p(n) be the peak value of that sequence. For a given threshold nmax, find the highest peak value max(p(n)) for all Collatz sequences starting with integers between 1 and nmax.
Nice one
Good problem!
How would I speed this up?
If I input nmax = 2^60, my program cannot finish.
This solution will fail for nmax = 2; so I had to swap the order of two lines. See Solution 1088355.
i'm totally lost with this!
wrong, corrected in soln 329062
I only feel justified in doing this because the previous best answer was a look-up table. :P
Clever pattern, but still gaming the system. This is not the absolute highest Collatz peak as you go to infinity. Yuval, you should be ashamed of submitting this without apologies.
This really doesn't solve the problem it's just gaming the results.
Boo.
Ooooooh this is evil.
Pathetic
Test if a Number is a Palindrome without using any String Operations
149 Solvers
143 Solvers
784 Solvers
276 Solvers
443 Solvers