IPB

Welcome Guest ( Log In | Register )

 
 Collatz Conjecture
leonon
post Mar 5 2010, 07:16 PM
Post #1


Newbie


Group: Members
Posts: 4
Joined: 16-September 05
Member No.: 12,039



http://www.xkcd.com/710/

CODE
SetActiveWindow Untitled - Notepad
delay 50

constants
random=1
randomin=0
randomadd=999999
n=99999
n2=
n3=
end

if $random=1
Compute $n = TRUNC( RND(1) * $randomadd ) + $randomin + 1
keys Random start is $n
keys {return}
end

loop 9001
compute $n2= $n mod 2
if $N2= 0
compute $N=$N/2
else
compute $n=$N*3+1
end
keys $n
keys {return}
compute $n3=$n3 + 1
if $n=1
keys $N3 calculations to end
STOP
end
end

It's kind of neat to watch, like a mathematical goldfish.
Go to the top of the page
 
+


 



Lo-Fi Version Time is now: 9th September 2010 - 07:42 AM