mirror of
https://github.com/jgm/pandoc.git
synced 2026-07-09 02:51:08 +00:00
a2be4ac62b
Closes #8942.
29 lines
601 B
Typst
29 lines
601 B
Typst
#set page(width: 10cm, height: auto)
|
|
#set heading(numbering: "1.")
|
|
|
|
= Fibonacci sequence
|
|
The Fibonacci sequence is defined through the
|
|
recurrence relation $F_n = F_(n-1) + F_(n-2)$.
|
|
It can also be expressed in _closed form:_
|
|
|
|
$ F_n = round(1 / sqrt(5) phi.alt^n), quad
|
|
phi.alt = (1 + sqrt(5)) / 2 $
|
|
|
|
#let count = 8
|
|
#let nums = range(1, count + 1)
|
|
#let fib(n) = (
|
|
if n <= 2 { 1 }
|
|
else { fib(n - 1) + fib(n - 2) }
|
|
)
|
|
|
|
The first #count numbers of the sequence are:
|
|
|
|
#align(center, table(
|
|
columns: count,
|
|
..nums.map(n => $F_#n$),
|
|
..nums.map(n => str(fib(n))),
|
|
))
|
|
|
|
#include "undergradmath.typ"
|
|
|