# Testcase X = 6 INCREASE X INCREASE X INCREASE X INCREASE X INCREASE X INCREASE X # K = 180 INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L REPEAT L TIMES ( INCREASE K INCREASE K INCREASE K INCREASE K INCREASE K INCREASE K INCREASE K INCREASE K INCREASE K ) # U: var is in X # V: var is in Y INCREASE U # A: x is odd # B: x is even INCREASE B REPEAT X TIMES ( REPEAT B TIMES ( INCREASE C ) REPEAT A TIMES ( CLEAR A INCREASE B ) REPEAT C TIMES ( CLEAR C CLEAR B INCREASE A ) ) PRINT X # E = 1 <-> x > 1 INCREASE E REPEAT K TIMES ( REPEAT E TIMES ( # 3x+1 REPEAT A TIMES ( REPEAT U TIMES ( REPEAT X TIMES ( INCREASE X INCREASE X ) INCREASE X PRINT X ) REPEAT V TIMES ( REPEAT Y TIMES ( INCREASE Y INCREASE Y ) INCREASE Y PRINT Y ) ) # x / 2; x must be even now ### REPEAT U TIMES ( CLEAR Y CLEAR A CLEAR B INCREASE B REPEAT X TIMES ( REPEAT B TIMES ( INCREASE C ) REPEAT A TIMES ( CLEAR A INCREASE B INCREASE Y ) REPEAT C TIMES ( CLEAR B CLEAR C INCREASE A ) ) INCREASE V CLEAR U ) REPEAT V TIMES ( CLEAR X CLEAR A CLEAR B INCREASE B REPEAT Y TIMES ( REPEAT B TIMES ( INCREASE C ) REPEAT A TIMES ( CLEAR A INCREASE B INCREASE X ) REPEAT C TIMES ( CLEAR B CLEAR C INCREASE A ) ) INCREASE U CLEAR V ) ### end x/2 # Check if x == 1 CLEAR F REPEAT U TIMES ( REPEAT X TIMES ( CLEAR E REPEAT F TIMES ( INCREASE E CLEAR F ) INCREASE F ) ) REPEAT V TIMES ( REPEAT Y TIMES ( CLEAR E REPEAT F TIMES ( INCREASE E CLEAR F ) INCREASE F ) ) ### End check REPEAT U TIMES ( PRINT X ) REPEAT V TIMES ( PRINT Y ) ### THE PARENTEESI FOR E = 1 loop ) # I # I # Main loop end v )