Talk:Euler problems/11 to 20 - Revision history
http://www.haskell.org/haskellwiki/index.php?title=Talk:Euler_problems/11_to_20&action=history
Revision history for this page on the wikienMediaWiki 1.19.5-1+deb7u1Fri, 22 Aug 2014 14:14:22 GMTKapil: Improvement to solution to Collatz problem in ProjectEuler
http://www.haskell.org/haskellwiki/index.php?title=Talk:Euler_problems/11_to_20&diff=33403&oldid=prev
http://www.haskell.org/haskellwiki/index.php?title=Talk:Euler_problems/11_to_20&diff=33403&oldid=prev<p>Improvement to solution to Collatz problem in ProjectEuler</p>
<p><b>New page</b></p><div>It seems to me that the solution posted to the Collatz problem is not<br />
the most efficient. In order to find integer that gives the longest chain<br />
it is not necessary to _find_ that longest chain. So one needs to use<br />
a Boolean function that merely checks whether the chain for n is<br />
longer than that for m where m is the winner so far.<br />
<br />
This does not need to repeatedly calculate the chain for m if we <br />
the tuple (m,c,m') where c is the length of the chain from m to m'<br />
which we have calculated so far.<br />
<br />
As far as I know the longest chain is significantly longer than all<br />
the other chains considered so this should save us a lot of time by<br />
avoiding computing that chain.</div>Sun, 31 Jan 2010 14:14:35 GMTKapilhttp://www.haskell.org/haskellwiki/Talk:Euler_problems/11_to_20