The "Ulam Conjecture" (Collatz conjecture)
#7
Code: (Select All)
_Title "Collatz collapse #2" 'b+ 2022-05-24
_Define A-Z As _INTEGER64
Width , 48
For start = 1 To 2298024 ' to just before the screen scrolls
    steps = 0: n = start: max = 0
    While n <> 1
        If n Mod 2 Then
            n = n * 3 + 1
            If n > max Then max = n
            steps = steps + 1
        End If
        While n Mod 2 = 0
            n = n / 2
            steps = steps + 1
        Wend
    Wend
    If n = 1 Then 'Print start; "took"; steps; "steps."
        If steps > maxsteps Then Print start; "took"; steps; "steps, high"; max: maxsteps = steps
    End If
Next

Collatz collapse revisited.
b = b + ...
Reply


Messages In This Thread
RE: The "Ulam Conjecture" (Collatz conjecture) - by bplus - 05-24-2022, 07:17 PM



Users browsing this thread: 1 Guest(s)