Skip to content

Instantly share code, notes, and snippets.

@felko
Last active June 28, 2016 16:14
Show Gist options
  • Save felko/9b1ccb929f62e552bc0c to your computer and use it in GitHub Desktop.
Save felko/9b1ccb929f62e552bc0c to your computer and use it in GitHub Desktop.
Loads in memory the fibonacci suite (but doesn't display it)
FIBONACCI SEQUENCE
You have to use an IDE or website in order to visualize the memory
+++++++> The number of numbers to load
+>+> Setup the two first numbers
<[<]>[
[>] Move to the right most ptr
<< [->>+>+<<<] Store the first number in the 2 next free ptr
>>>[<<<+>>>-] Shift the last value in the first number ptr
<< [->>+>+<<<] Store the second number in the 2 next free ptr
>>>[<<<+>>>-] Shift the last ptr into the second number ptr
< [-<+>] Add up the last 2 ptr
<[<]>-] Move to the leftmost ptr and decrement it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment