# Assign big num for loop
INCREASE L INCREASE L INCREASE L INCREASE L INCREASE L
REPEAT L TIMES (
REPEAT L TIMES (
INCREASE L
)
)
INCREASE B
# I: bool - is iteration ongoing (hasn't reached 1 and should still iterate)
INCREASE I
REPEAT L TIMES (
# check: do we keep iterating (is x > 1)
REPEAT B TIMES (
CLEAR I
CLEAR K
REPEAT X TIMES (
# if K is true: set I to true
REPEAT K TIMES (
CLEAR I INCREASE I
)
# set K to true
CLEAR K INCREASE K
)
)
REPEAT I TIMES (
# Print number of the series
PRINT X
# calculate halved X to H and find out if X is even in B
CLEAR H # halved value
REPEAT A TIMES (
CLEAR A # current iter is uneven
CLEAR B INCREASE B # current iter is even
)
REPEAT X TIMES (
# increment accumulation H if iteration is even
REPEAT A TIMES (
INCREASE H
CLEAR A
INCREASE C
)
# flip A and B
REPEAT B TIMES (
CLEAR B
INCREASE A
)
REPEAT C TIMES (
INCREASE B
CLEAR C
)
)
# if X is even: move H value to X
REPEAT B TIMES (
CLEAR X REPEAT H TIMES ( INCREASE X )
)
# if x not even
REPEAT A TIMES (
# perform X+=2X+1
REPEAT X TIMES (
INCREASE X
INCREASE X
)
INCREASE X
PRINT X
# next is guaranteed to be even and it is 3H+2
CLEAR X REPEAT H TIMES ( INCREASE X INCREASE X INCREASE X )
INCREASE X INCREASE X
)
)
)
INCREASE S
PRINT S