Tetranacci and pentanacci numbers
DefinitionPentanacci numbers#✓fully proved
MetaMathlibExt.pentanacciNumber
The pentanacci numbers \(a_n\), for natural numbers \(n\), are defined by \(a_0 = 1\), \(a_1 = 1\), \(a_2 = 2\), \(a_3 = 4\), \(a_4 = 8\) and \(a_{n+5} = a_{n+4} + a_{n+3} + a_{n+2} + a_{n+1} + a_n\) for every \(n\), so each term from index \(5\) on is the sum of the five terms before it.
Their ordinary generating function is \(1/(1 - t - t^2 - t^3 - t^4 - t^5)\); up to a shift of index they form OEIS A001591.
def pentanacciNumber : ℕ → ℕ
| 0 => 1
| 1 => 1
| 2 => 2
| 3 => 4
| 4 => 8
| n + 5 =>
pentanacciNumber (n + 4) + pentanacciNumber (n + 3) +
pentanacciNumber (n + 2) + pentanacciNumber (n + 1) +
pentanacciNumber n
DefinitionTetranacci sequence#✓fully proved
MetaMathlibExt.tetranacci
The Tetranacci sequence 0, 0, 0, 1, 1, 2, 4, 8, … (OEIS A000078), in which
each term after the first four is the sum of its four predecessors.
def tetranacci : ℕ → ℕ
| 0 => 0
| 1 => 0
| 2 => 0
| 3 => 1
| n + 4 =>
tetranacci (n + 3) + tetranacci (n + 2) + tetranacci (n + 1) + tetranacci n
Used by 1
2 fully proved
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.