Created
August 4, 2014 19:32
-
-
Save lasarus/ec76f0c817e6d888fc63 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Read input until newline and translate into a number | |
, ----- ----- [ +++++ +++++ | |
> [ - > +++++ +++++ < ] | |
+++++ +++ [ - < ----- - > ] | |
< [ - >> + << ] | |
>> [ - < + > ] | |
<< , ----- ----- ] | |
Start loop and run the algorithm on each number between zero and the input number | |
>> - < [ > + | |
[ - > + >> + <<< ] > [ - < + > ] >> | |
Decide the parity of the number | |
Divide the number by two until it is zero and sum the remainders | |
[ | |
[ >> + << - < + >> + < [ < - >> - < [ - << + >> ] ] << [ - >> + << ] > [ - > + >> - <<< ] > - ] | |
>> [ - << + >> ] << | |
] > | |
Run Modulo 2 on the remainder sum and print the result | |
[ - < + >> + < [ < - >> - < [ - << + >> ] ] << [ - >> + << ] > [ - > + < ] > - ] > | |
< +++++ +++ [ - > +++++ + < ] > . [-] | |
End the loop if the input number has reached zero | |
<<<<<< -] | |
Print newline | |
+++++ +++++ . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment