
The 3n+1 problem - denzil_correa
http://blog.racket-lang.org/2012/10/the-3n1-problem_4990.html
======
dollarpizza
Funny how now matter where they start out, just about everybody who attempts
to take on the 3x+1 problem eventually ends up in pretty much the same place:

<http://xkcd.com/710/>

~~~
DanielRibeiro
And it gets more interesting:

 _In 2007, researchers Kurtz and Simon, building on earlier work by J.H.
Conway in the 1970s,[8] proved that a natural generalization of the Collatz
problem is algorithmically undecidable.[7]_

From <http://en.wikipedia.org/wiki/Collatz_conjecture>

------
kachnuv_ocasek
Interesting article. For those not familiar with the problem, it's called the
Collatz conjecture.

I'm curious how this would behave in case of the conjecture being false, i.e.
found a number that wouldn't reduce to 1 by the algorithm.

~~~
lmm
The function doesn't look to be tail-recursive, so my guess would be a stack
overflow.

Of course, if you run it and get a stack overflow, you have no way of knowing
whether the number was really a counterexample or just one that took many
steps to reach 1.

~~~
waterhouse
It would be a stack overflow, except Racket does not stack overflow--it will
grab more memory, make a bigger stack, and continue. Eventually your problem
would be "out of memory".

------
artursapek
That's funny, I just did the Collatz in Racket for a class.

------
sixothree
Sounds like a Project Euler problem.

~~~
smilliken
Open invitation: drop by the MixRank office (SoMA, SF) on Wednesday evenings
for friendly Project Euler competitions.

~~~
jboggan
I heartily recommend this.

