# Commands: # CLEAR X # INCREASE X # PRINT X # REPEAT X TIMES ( ... ) # Longest Collatz conjecture: 113 (at 871) # Max amount to A (unpacked; currently 113) INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A INCREASE A PRINT X # Start the conjecture INCREASE C # Will be nuked when reaches 1 (and if already 1) INCREASE K REPEAT X TIMES ( REPEAT K TIMES ( REPEAT M TIMES ( INCREASE N ) INCREASE M REPEAT N TIMES ( CLEAR K # Loop will break ) ) ) REPEAT K TIMES ( # If loop went through (stopped at 1) CLEAR C ) REPEAT X TIMES ( # Is the first number odd? INCREASE P REPEAT O TIMES ( CLEAR O CLEAR P ) REPEAT P TIMES ( INCREASE O ) ) REPEAT A TIMES ( REPEAT C TIMES ( # Continue if hasn't reached 1 CLEAR O CLEAR P CLEAR Q CLEAR R CLEAR S REPEAT X TIMES ( # Is odd? May also check for dividability by 4 (and perhaps 8). INCREASE P REPEAT O TIMES ( CLEAR O CLEAR P INCREASE R REPEAT Q TIMES ( CLEAR Q CLEAR R INCREASE S # Divisible by neljä ) REPEAT R TIMES ( INCREASE Q CLEAR S ) ) REPEAT P TIMES ( INCREASE O ) ) REPEAT O TIMES ( # Multiply and increment if odd CLEAR S REPEAT X TIMES ( INCREASE Y INCREASE Y INCREASE Y ) INCREASE Y PRINT Y CLEAR X ) REPEAT X TIMES ( # Clone to Y if necessary INCREASE Y ) CLEAR X CLEAR D CLEAR E CLEAR I INCREASE I REPEAT S TIMES ( # If divisible by 4 CLEAR I CLEAR J CLEAR K CLEAR L REPEAT Y TIMES ( INCREASE E REPEAT D TIMES ( INCREASE J CLEAR D CLEAR E INCREASE L REPEAT K TIMES ( INCREASE X CLEAR K CLEAR L ) REPEAT L TIMES ( INCREASE K ) ) REPEAT E TIMES ( INCREASE D ) ) PRINT J PRINT X ) REPEAT I TIMES ( # If not dividing by 4 REPEAT Y TIMES ( # Divide by 2 INCREASE E REPEAT D TIMES ( INCREASE X CLEAR D CLEAR E ) REPEAT E TIMES ( INCREASE D ) ) PRINT X ) # Clean up CLEAR Y # Stop if 1 (Clear C) INCREASE V REPEAT X TIMES ( REPEAT V TIMES ( REPEAT Z TIMES ( INCREASE W ) INCREASE Z REPEAT W TIMES ( CLEAR V # Loop will break CLEAR W # Clear everything else if continuing CLEAR Z ) ) ) REPEAT V TIMES ( # If loop went through (stopped at 1) CLEAR C ) ) )