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.

A301759 Semiperiods of the Fibonacci sequence mod n.

Original entry on oeis.org

1, 3, 4, 6, 10, 12, 8, 12, 12, 30, 10, 24, 14, 24, 40, 24, 18, 12, 18, 60, 16, 30, 24, 24, 50, 42, 36, 48, 14, 120, 30, 48, 40, 18, 80, 24, 38, 18, 56, 60, 20, 48, 44, 30, 120, 24, 16, 24, 56, 150, 72, 84, 54, 36, 20, 48, 72, 42, 58, 120, 30, 30, 48, 96, 70, 120, 68, 36, 48
Offset: 1

Views

Author

Michel Marcus, Mar 26 2018

Keywords

Comments

It is the period of the Fibonacci sequence up to sign.

Examples

			For n = 7 we get 1,0,1,1,2,3,5,1,-1,0,-1,-1,... so a(7) = 8.
		

Crossrefs

Cf. A000045 (Fibonacci numbers), A001175 (Pisano periods).

Programs

  • Mathematica
    Table[NestWhile[# + 1 &, 1, ! (Mod[Fibonacci[#], n] == 0 && With[{f = Mod[Fibonacci[# + 1], n]}, f == 1 || f == n - 1]) &], {n, 69}] (* Jan Mangaldan, Sep 12 2021 *)
  • PARI
    a(n) = if (n==1, 1, for(k=1,oo, if (((fibonacci(k) % n) == 0) && (((fibonacci(k+1) % n) == 1) || ((fibonacci(k+1) % n) == n-1)), return (k))));