# Checking if it is one should be made more efficient, maybe by keeping track of it is one every time a change to V is made? only needs to be done on division INCREASE U REPEAT X TIMES ( # Sets Q to 1 if we should print anything after. if its zero, we dont do anything INCREASE V REPEAT O TIMES ( # Runs on second ( V > 1 ), sets Q = 1 CLEAR O INCREASE Q ) REPEAT U TIMES ( # Runs on first CLEAR Q INCREASE O CLEAR U ) ) PRINT X CLEAR X INCREASE E # Later should be replaced with 1000 or similar INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E REPEAT E TIMES ( INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E ) REPEAT E TIMES ( INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E INCREASE E ) REPEAT E TIMES ( REPEAT Q TIMES ( INCREASE A CLEAR J CLEAR N # Check for divisible by 2, output to X, Y AND J REPEAT V TIMES ( REPEAT A TIMES ( CLEAR A INCREASE B INCREASE X INCREASE J #INCREASE N CLEAR Y ) REPEAT C TIMES ( CLEAR C INCREASE A CLEAR X INCREASE Y ) REPEAT B TIMES ( CLEAR B INCREASE C ) ) CLEAR A CLEAR B CLEAR C #PRINT X #PRINT Y REPEAT X TIMES ( # pariton, V = 3*V # Tiedetään, että seuraava tulee olemaan aina parillinen # N on tässä vaiheessa puolet arvosta (ensimmäisestä aloittaen) REPEAT V TIMES ( INCREASE N INCREASE N INCREASE N #INCREASE V #INCREASE V ) #INCREASE V INCREASE N # Nyt N on yhtä suuri kuin nykyinen tarvittava elementti #PRINT N REPEAT J TIMES ( # Lisätään siihen J niin saadaan sitä seuraava arvo INCREASE V ) PRINT N #PRINT V #PRINT J ) REPEAT Y TIMES ( # parillinen, V = V / 2 CLEAR V CLEAR O INCREASE U REPEAT J TIMES ( INCREASE V REPEAT U TIMES ( # Runs on first REPEAT O TIMES ( # Runs on second ( V > 1 ), sets Q = 1 INCREASE Q CLEAR U ) REPEAT U TIMES ( CLEAR Q INCREASE O ) ) ) ) PRINT V ) )