Created
December 30, 2015 06:07
-
-
Save objmagic/94e6fd2311338d9bf45b to your computer and use it in GitHub Desktop.
LaTeX is Turing complete
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
| \newcount \temp \newcount \fone \newcount \ftwo \newcount \counter | |
| \newcommand{\fibonacci}[1]{ | |
| \counter=#1 | |
| \fone=1 | |
| \ftwo=1 | |
| \temp=0 | |
| \the\fone, \the\ftwo | |
| \fibloop | |
| } | |
| \newcommand{\fibloop}{, | |
| \let\next= \fibloop | |
| \temp=\fone | |
| \fone=\ftwo | |
| \advance \ftwo by \temp | |
| \ifnum \counter=0 \let\next=\relax \else \advance \counter by -1 \fi | |
| \the\ftwo | |
| \next | |
| } | |
| \documentclass[a4paper]{article} | |
| \setlength{\parindent}{0pt} | |
| \setlength{\oddsidemargin}{0pt} | |
| \setlength{\topmargin}{0pt} | |
| \begin{document} | |
| \fibonacci{10} | |
| \end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment