22 lines
429 B
TeX
22 lines
429 B
TeX
\newcount\n
|
|
\newcount\r
|
|
\newcount\x
|
|
\newcount\ii
|
|
|
|
\def\catalan#1{%
|
|
\n#1\advance\n by1\ii1\r1%
|
|
\loop{%
|
|
\x\ii%
|
|
\multiply\x by 2 \advance\x by -1 \multiply\x by 2%
|
|
\global\multiply\r by\x%
|
|
\global\advance\ii by1%
|
|
\global\divide\r by\ii%
|
|
} \ifnum\number\ii<\n\repeat%
|
|
\the\r
|
|
}
|
|
|
|
\rightskip=0pt plus1fil\parindent=0pt
|
|
\loop{${\rm Catalan}(\the\x) = \catalan{\the\x}$\hfil\break}%
|
|
\advance\x by 1\ifnum\x<15\repeat
|
|
|
|
\bye
|