Created
April 1, 2016 10:30
-
-
Save kozross/3ccc2496eb35f08b348706484fe88f02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4000000 constant LIMIT | |
\ n -- f | |
: is-even? 2 mod 0= ; | |
\ w1 w2 w3 -- w2 w1 w3 | |
: flip rot swap ; | |
\ total prev curr -- total+ curr next | |
: add-even-and-gen dup is-even? | |
if flip dup under+ flip | |
then dup under+ swap ; | |
: do-the-needful begin 0 1 2 add-even-and-gen dup LIMIT > until rot ; | |
do-the-needful . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment