cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A356891 a(n) = a(n-1) * a(n-2) + 1 if n is even, otherwise a(n) = a(n-3) + 1, with a(0) = a(1) = 1.

Original entry on oeis.org

1, 1, 2, 2, 5, 3, 16, 6, 97, 17, 1650, 98, 161701, 1651, 266968352, 161702, 43169316455105, 266968353, 11524841314155180292066, 43169316455106, 497519521785644682185076928856988997, 11524841314155180292067
Offset: 0

Views

Author

J. Conrad, Sep 02 2022

Keywords

Examples

			For n=2, a(2) = a(0) * a(1) + 1 = 2.
For n=3, a(3) = a(0) + 1 = 2.
For n=4, a(4) = a(3) * a(2) + 1 = 5.
		

Crossrefs

Cf. A007660.

Programs

  • Mathematica
    a[n_] := a[n] = If[EvenQ[n], a[n - 1]*a[n - 2], a[n - 3]] + 1; a[0] = a[1] = 1; Array[a, 22, 0] (* Amiram Eldar, Sep 10 2022 *)
  • Python
    def A356891(length):
        output = [1] * length
        for n in range(2, length):
            output[n] += output[n-3] if n % 2 else output[n-1] * output[n-2]
        return output