\documentclass{minimal} \usepackage{ifthen} \usepackage{intcalc} \newcounter{mycount} \newboolean{fizzOrBuzz} \newcommand\fizzBuzz[1]{% \setcounter{mycount}{1}\whiledo{\value{mycount}<#1} { \setboolean{fizzOrBuzz}{false} \ifthenelse{\equal{\intcalcMod{\themycount}{3}}{0}}{\setboolean{fizzOrBuzz}{true}Fizz}{} \ifthenelse{\equal{\intcalcMod{\themycount}{5}}{0}}{\setboolean{fizzOrBuzz}{true}Buzz}{} \ifthenelse{\boolean{fizzOrBuzz}}{}{\themycount} \stepcounter{mycount} \\ } } \begin{document} \fizzBuzz{101} \end{document}