Nice one
Good problem!
good.
If you want to add more tests: https://oeis.org/A006884 and https://oeis.org/A006885 contain the relevant sequences.
function pmax = peakOfPeaks(nmax)
pmax=1;
tmp=[];
for i=1:nmax
j=i;
tmp=[tmp j];
while j~=1
if mod(j,2)==0
j=j/2;
tmp=[tmp j];
else
j=3*j+1;
tmp=[tmp j];
end
end
if pmax
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
990 Solvers
388 Solvers
333 Solvers
Compute a dot product of two vectors x and y
757 Solvers
Get the elements of diagonal and antidiagonal for any m-by-n matrix
288 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!