[Jprogramming] Collatz Problem again

June Kim juneaftn at gmail.com
Sat Feb 3 23:39:09 HKT 2007


Have a look at this problem:
http://www.programming-challenges.com/pg.php?page=downloadproblem&probid=110101&format=html

In short, you need to calculate the maximum cycle length in a given range.

Roger wrote an essay which is related to this problem.
http://www.jsoftware.com/jwiki/Essays/Collatz_Conjecture

Suppose we want to calculate the maximum cycle length of collatz
sequences for 1, ..., 1e6.

It would be defined, using Roger's definition, as >./ cn 1e6

It currently takes around 40 secs on the computer I'm using. Could you
improve its efficiency?


More information about the Programming mailing list