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
Return the largest number that is adjacent to a zero
2961 Solvers
575 Solvers
Solve the set of simultaneous linear equations
160 Solvers
Return the first and last character of a string
1319 Solvers
417 Solvers