[Tutor] clearing a text document

max baseman dos.fool at gmail.com
Thu Aug 30 14:11:10 CEST 2007


thats what it does but in order to just be able to let it sit and  
work for as long as it can i made it a endless loop of just trying  
every number, for now it just displays the highest on the screen but  
it would be nice to get it in a text document

thanks

On Aug 30, 2007, at 4:53 AM, Kent Johnson wrote:

> max baseman wrote:
>> right it's for a quick math "game" the rules are simple you start   
>> with any number to get the next number you, a. if it's odd  
>> multiply  by 3 than add 1 or b. if it's even divide by two,  the  
>> point of this  is to see how long it takes to get to one are it  
>> starts to repeat  4,2,1,4,2,1...
>> now im looking for a a number with  a very high amount of numbers   
>> till you get to 1 so every time it's finds a new one i would like  
>> it  to write that to a file and clear the last entry,
>
> If your goal is to find long sequences why not write your program  
> to try every number up to some limit and find the longest?
>
> It's a nice use of generators, for those who know what they are...
>
> These sequences are known as hailstone numbers. The (unproven)  
> conjecture that the sequence will always terminate is called  
> Collatz' Conjecture. Some interesting info and pictures here:
> http://sprott.physics.wisc.edu/pickover/hailstone.html
> http://mathworld.wolfram.com/CollatzProblem.html
>
> Kent



More information about the Tutor mailing list