MC: Ping-Pong Cubes
|
05-26-2018, 08:19 PM
Post: #12
|
|||
|
|||
RE: MC: Ping-Pong Cubes
The first program is a subroutine that checks if the number is a ping-pong number, I called it ISPP?
« DUP 2. MOD 1 WHILE PICK3 10 > OVER AND REPEAT DROP SWAP 10. / IP DUP 2. MOD ROT OVER XOR END NIP NIP » The next program uses ISPP? To check for ping-pong numbers starting with 10, if a ping-pong number is found checks if the square of that number is a ping-pong number, if so stores it in a list and the process repeat ten times in a START-NEXT loop. « { } 10 1 10 START DO 1 + UNTIL IF DUP ISPP? THEN DUP SQ ISPP? ELSE 0 END END SWAP OVER + SWAP NEXT DROP » |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)