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.

Showing 1-4 of 4 results.

A001175 Pisano periods (or Pisano numbers): period of Fibonacci numbers mod n.

Original entry on oeis.org

1, 3, 8, 6, 20, 24, 16, 12, 24, 60, 10, 24, 28, 48, 40, 24, 36, 24, 18, 60, 16, 30, 48, 24, 100, 84, 72, 48, 14, 120, 30, 48, 40, 36, 80, 24, 76, 18, 56, 60, 40, 48, 88, 30, 120, 48, 32, 24, 112, 300, 72, 84, 108, 72, 20, 48, 72, 42, 58, 120, 60, 30, 48, 96, 140, 120, 136
Offset: 1

Views

Author

Keywords

Comments

These numbers might also have been called Fibonacci periods.
Also, number of perfect multi-Skolem type sequences of order n.
Index the Fibonacci numbers so that 3 is the fourth number. If the modulo base is a Fibonacci number (>=3) with an even index, the period is twice the index. If the base is a Fibonacci number (>=5) with an odd index, the period is 4 times the index. - Kerry Mitchell, Dec 11 2005
Each row of the image represents a different modulo base n, from 1 at the bottom to 24 at the top. The columns represent the Fibonacci numbers mod n, from 0 mod n at the left to 59 mod n on the right. In each cell, the brightness indicates the value of the residual, from dark for 0 to near-white for n-1. Blue squares on the left represent the first period; the number of blue squares is the Pisano number. - Kerry Mitchell, Feb 02 2013
a(n) = least positive integer k such that F(k) == 0 (mod n) and F(k+1) == 1 (mod n), where F = A000045 is the Fibonacci sequence. a(n) exists for all n by Dirichlet's box principle and the fact that the positive integers are well-ordered. Cf. Saha and Karthik (2011). - L. Edson Jeffery, Feb 12 2014

Examples

			For n=4, take the Fibonacci sequence (A000045), 1, 1, 2, 3, 5, 8, 13, 21, ... (mod 4), which gives 1, 1, 2, 3, 1, 0, 1, 1, .... This repeats a pattern of length 6, so a(4) = 6. - _Michael B. Porter_, Jul 19 2016
		

References

  • B. H. Hannon and W. L. Morris, Tables of Arithmetical Functions Related to the Fibonacci Numbers. Report ORNL-4261, Oak Ridge National Laboratory, Oak Ridge, Tennessee, Jun 1968.
  • J. Roberts, Lure of the Integers, Math. Assoc. America, 1992, p. 162.
  • J. H. Silverman, A Friendly Introduction to Number Theory, 3rd ed., Pearson Education, Inc, 2006, pp. 304 - 309.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • S. Vajda, Fibonacci and Lucas numbers and the Golden Section, Ellis Horwood Ltd., Chichester, 1989. See p. 89. - N. J. A. Sloane, Feb 20 2013

Crossrefs

Cf. A060305 (Fibonacci period mod prime(n)), A003893.
Cf. A001178 (Fibonacci frequency), A001179 (Leonardo logarithm), A235702 (fixed points), A066853 (number of elements in the set of residua), A222413, A296240 (Pisano quotients for primes).

Programs

  • Haskell
    a001175 1 = 1
    a001175 n = f 1 ps 0 where
       f 0 (1 : xs) pi = pi
       f _ (x : xs) pi = f x xs (pi + 1)
       ps = 1 : 1 : zipWith (\u v -> (u + v) `mod` n) (tail ps) ps
    -- Reinhard Zumkeller, Jan 15 2014
    
  • Maple
    a:= proc(n) local f, k, l; l:= ifactors(n)[2];
          if nops(l)<>1 then ilcm(seq(a(i[1]^i[2]), i=l))
        else f:= [0, 1];
             for k do f:=[f[2], f[1]+f[2] mod n];
                      if f=[0, 1] then break fi
             od; k
          fi
        end:
    seq(a(n), n=1..100);  # Alois P. Heinz, Sep 18 2013
  • Mathematica
    Table[a={1, 0}; a0=a; k=0; While[k++; s=Mod[Plus@@a, n]; a=RotateLeft[a]; a[[2]]=s; a!=a0]; k, {n, 2, 100}] (* T. D. Noe, Jul 19 2005 *)
    a[1]=1; a[n_]:= For[k = 1, True, k++, If[Mod[Fibonacci[k], n]==0 && Mod[ Fibonacci[k+1], n]==1, Return[k]]]; Table[a[n], {n, 100}] (* Jean-François Alcover, Feb 11 2015 *)
    test[{0, 1, }]:= False; test[]:= True;
    nest[k_][{a_, b_, c_}]:= {Mod[b, k], Mod[a+b, k], c+1};
    A001175[1] := 1;
    A001175[k_]:= NestWhile[nest[k], {1, 1, 1}, test][[3]];
    Table[A001175[n], {n, 100}] (* Leo C. Stein, Nov 08 2019 *)
    Module[{nn=1000,fibs},fibs=Fibonacci[Range[nn]];Table[Length[ FindTransientRepeat[ Mod[fibs,n],2][[2]]],{n,70}]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 02 2020 *)
  • PARI
    minWSS=2^64; \\ PrimeGrid search
    fibmod(n,m)=((Mod([1,1;1,0],m))^n)[1,2]
    entryp(p)=my(k=p+[0, -1, 1, 1, -1][p%5+1], f=factor(k)); for(i=1, #f[, 1], for(j=1, f[i, 2], if((Mod([1, 1; 1, 0], p)^(k/f[i, 1]))[1, 2], break); k/=f[i, 1])); k
    entry(n)=if(n==1,return(1)); my(f=factor(n), v); v=vector(#f~, i, if(f[i,1]>=minWSS, entryp(f[i,1]^f[i,2]), entryp(f[i,1])*f[i,1]^(f[i,2] - 1))); if(f[1,1]==2&&f[1,2]>1, v[1]=3<Charles R Greathouse IV, Feb 13 2014; updated Dec 14 2016; updated Aug 24 2021; updated Jul 08 2024
    
  • Python
    from functools import reduce
    from sympy import factorint, lcm
    def A001175(n):
        if n == 1:
            return 1
        f = factorint(n)
        if len(f) > 1:
            return reduce(lcm, (A001175(a**f[a]) for a in f))
        else:
            k,x = 1, [1,1]
            while x != [0,1]:
                k += 1
                x = [x[1], (x[0]+x[1]) % n]
            return k # Chai Wah Wu, Jul 17 2019
  • Sage
    def a(n): return BinaryRecurrenceSequence(1,1).period(n) # Ralf Stephan, Jan 23 2014
    

Formula

Let the prime factorization of n be p1^e1...pk^ek. Then a(n) = lcm(a(p1^e1), ..., a(pk^ek)). - T. D. Noe, May 02 2005
a(n) = n-1 if n is a prime > 5 included in A003147 ( n = 11, 19, 31, 41, 59, 61, 71, 79, 109...). - Benoit Cloitre, Jun 04 2002
K. S. Brown shows that a(n)/n <= 6 for all n and a(n)=6n if and only if n has the form 2*5^k.
a(n) = A001177(n)*A001176(n) for n >= 1. - Henry Bottomley, Dec 19 2001
a(n) <= 2*n+2 if n is a prime > 5, by Wall's Theorems 6 and 7; see A060305, A222413, A296240. - Jonathan Sondow, Dec 10 2017
a(2^k) = 3*2^(k-1) for k > 0. In general, if a(p) != a(p^2) for p prime, then a(p^k) = p^(k-1)*a(p) [Wall, 1960]. - Chai Wah Wu, Feb 25 2022

A001178 Fibonacci frequency of n.

Original entry on oeis.org

0, 4, 3, 2, 3, 1, 2, 2, 1, 2, 3, 1, 3, 2, 3, 1, 2, 1, 2, 2, 2, 2, 2, 0, 3, 3, 2, 2, 3, 1, 2, 2, 3, 2, 2, 1, 3, 2, 3, 2, 3, 2, 3, 2, 1, 2, 3, 1, 3, 2, 2, 3, 3, 2, 3, 2, 2, 3, 4, 1, 2, 2, 2, 3, 3, 1, 3, 2, 2
Offset: 1

Views

Author

Keywords

Comments

a(A235702(n)) = 0. - Reinhard Zumkeller, Jan 15 2014
a(n) is the least nonnegative integer k such that the function iterates f: {1, 2, ...} -> {1, 2, ...}, n -> f(n) = A001175(n), satisfy f^[k+1](n) = f^[k](n), where f^[0] is the identity map f^[0](n) = n and f^[k+1] = f o f^[k]. See the Fulton and Morris link, where the function f is called pi and a(n)= omega(n) for n >= 2, and omega(24) should be 0. (see the Zumkeller remark on the Hannon and Morris reference) - Wolfdieter Lang, Jan 18 2015

References

  • B. H. Hannon and W. L. Morris, Tables of Arithmetical Functions Related to the Fibonacci Numbers. Report ORNL-4261, Oak Ridge National Laboratory, Oak Ridge, Tennessee, Jun 1968. [There is a typo in the value of a(24) given in the table on the last page.]
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a001178 = f 0 where
       f j x = if x == y then j else f (j + 1) y  where y = a001175 x
    -- Reinhard Zumkeller, Jan 15 2014
    
  • Mathematica
    pi[1] = 1;
    pi[n_] := For[k = 1, True, k++, If[Mod[Fibonacci[k], n] == 0 && Mod[ Fibonacci[k+1], n] == 1, Return[k]]];
    a[n_] := Length[FixedPointList[pi, n]] - 2;
    a /@ Range[100] (* Jean-François Alcover, Oct 28 2019 *)
  • Python
    from itertools import count
    def A001178(n): # uses function from A001175
        m = n
        for c in count(0):
            k = A001175(m)
            if k == m:
                return c
            m = k # Chai Wah Wu, Feb 28 2022

Formula

See a comment above and the program.

Extensions

a(24) corrected by Reinhard Zumkeller, Jan 15 2014

A379646 Irregular triangle T(n,k) where row n contains the trajectory of recursive mappings of A001175(x) starting with x = n and ending at fixed point A235249(n).

Original entry on oeis.org

1, 2, 3, 8, 12, 24, 3, 8, 12, 24, 4, 6, 24, 5, 20, 60, 120, 6, 24, 7, 16, 24, 8, 12, 24, 9, 24, 10, 60, 120, 11, 10, 60, 120, 12, 24, 13, 28, 48, 24, 14, 48, 24, 15, 40, 60, 120, 16, 24, 17, 36, 24, 18, 24, 19, 18, 24, 20, 60, 120, 21, 16, 24, 22, 30, 120, 23, 48, 24
Offset: 1

Views

Author

Michael De Vlieger, Dec 30 2024

Keywords

Comments

Row n contains recursive mappings of A001175(x) starting with x = n.

Examples

			Table begins:
   1;
   2,  3,   8,  12, 24;
   3,  8,  12,  24;
   4,  6,  24;
   5, 20,  60, 120;
   6, 24;
   7, 16,  24;
   8, 12,  24;
   9, 24;
  10, 60, 120;
  11, 10,  60, 120;
  12, 24;
  ...
		

Crossrefs

Programs

  • Mathematica
    q[{0, 1, }] := False; q[] := True;
    f[k_][{a_, b_, c_}] := {Mod[b, k], Mod[a + b, k], c + 1};
    s[1] := 1; s[k_] := s[k] = Which[
      PrimeQ[k] && k > 5, If[
        AnyTrue[PrimitiveRootList[k], Mod[#^2, k] == Mod[# + 1, k] &],
        k - 1,
        NestWhile[f[k], {1, 1, 1}, q][[-1]] ],
      PrimePowerQ[k], NestWhile[f[k], {1, 1, 1}, q][[-1]], True,
        LCM @@ Map[s[#] &, Power @@@ FactorInteger[k] ] ];
    Table[Most@ FixedPointList[s[#] &, n], {n, 24}]

A343184 Positions of records in A001178.

Original entry on oeis.org

1, 2, 127, 509, 1019, 2039, 4079, 16384, 32768, 65536, 131072, 262144, 524287, 1048573, 6291437
Offset: 1

Views

Author

N. J. A. Sloane, May 16 2021, following an email from Felix Lans

Keywords

Comments

When the Pisano-period map x -> A001175(x) is iterated, a(n) is the number of steps needed to reach a fixed point (that is, to reach a term of A235702).
The record values of A001178 at positions 1, 2, 127, 509, 1019, 2039, 4079, 16384, 32768, 65536, 131072, 262144, 524287, 1048573 are 0, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19.
Felix Lans remarks that from a(4) onwards, the terms appear to be very close to consecutive powers of 2, except that there is no term close to 2^13.

Crossrefs

Programs

  • Mathematica
    Block[{pi, k, s}, pi[1] = 1; pi[n_] := For[k = 1, True, k++, If[Mod[Fibonacci[k], n] == 0 && Mod[Fibonacci[k + 1], n] == 1, Return[k]]]; s = Array[Length[FixedPointList[pi, #]] - 2 &, 2^11]; Map[FirstPosition[s, #][[1]] &, Union@ FoldList[Max, s]] ] (* Michael De Vlieger, May 16 2021, after Jean-François Alcover at A001178  *)

Extensions

a(1)-a(12) from Felix Lans and confirmed by Rémy Sigrist, May 16 2021; a(13) and a(14) from Rémy Sigrist, May 16 2021.
a(15) from Chai Wah Wu, Mar 01 2022
Showing 1-4 of 4 results.