REPEAT X TIMES ( REPEAT X TIMES ( INCREASE O ) ) PRINT X REPEAT O TIMES ( CLEAR Q CLEAR P REPEAT X TIMES ( REPEAT P TIMES ( CLEAR Q INCREASE Q ) CLEAR P INCREASE P ) REPEAT Q TIMES ( CLEAR N CLEAR M CLEAR B CLEAR C CLEAR A INCREASE B REPEAT X TIMES ( CLEAR C REPEAT A TIMES ( INCREASE C ) REPEAT B TIMES ( INCREASE N CLEAR B INCREASE A ) REPEAT C TIMES ( CLEAR A INCREASE B INCREASE M ) ) #PRINT N #PRINT M #n-m optimoitavissa CLEAR S REPEAT N TIMES ( INCREASE S ) REPEAT M TIMES ( CLEAR W REPEAT S TIMES ( INCREASE W ) CLEAR K CLEAR S REPEAT W TIMES ( REPEAT K TIMES ( INCREASE S ) CLEAR K INCREASE K ) ) CLEAR L INCREASE L REPEAT S TIMES ( CLEAR L ) REPEAT L TIMES ( CLEAR X REPEAT N TIMES ( INCREASE X ) PRINT X ) #3x+1 REPEAT S TIMES ( CLEAR Y REPEAT X TIMES ( INCREASE Y ) REPEAT X TIMES ( INCREASE Y ) REPEAT Y TIMES ( INCREASE X ) INCREASE X PRINT X ) ) )