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.

A173635 Period 5 sequence: 1, 1, 4, 4, 2, ...

Original entry on oeis.org

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

Views

Author

Washington Bomfim, Nov 23 2010

Keywords

Comments

a(n) is the length of the period of the sequence (n^i) mod m, i=1,2,...; m = 10 or m = 5.

Examples

			a(0) = 1 because (0^i) mod 10 = 0, i=1,2,...;
a(2) = 4 since(2^1) mod 5 = 2, (2^2) mod 5 = 4, (2^3) mod 5 = 3, (2^4) mod 5 = 1, and (2^5) mod 5 = 2 again. So we have the sequence 2,4,3,1,... with period of length 4.
		

Programs

  • Magma
    &cat[ [1,1,4,4,2]: n in [0..23] ]; // Vincenzo Librandi, Jan 19 2018
  • Mathematica
    Flatten[Table[{1, 1, 4, 4, 2}, {20}]] (* T. D. Noe, Nov 20 2012 *)
    CoefficientList[ Series[(-1 - x - 4x^2 - 4x^3 - 2x^4)/(x^5 -1), {x, 0, 104}], x] (* or *)
    LinearRecurrence[{0, 0, 0, 0, 1}, {1, 1, 4, 4, 2}, 105] (* Robert G. Wilson v, Jan 20 2018 *)
  • PARI
    a(n) = [1, 1, 4, 4, 2][(n%5)+1] \\ Iain Fox, Jan 12 2018
    
  • PARI
    a(n) = ((1 + floor((n%5)/2))^2) % 7 \\ Iain Fox, Jan 12 2018
    
  • PARI
    first(n) = Vec((1 + x + 4*x^2 + 4*x^3 + 2*x^4)/(1 - x^5) + O(x^n)) \\ Iain Fox, Jan 12 2018
    

Formula

a(n) = (1 + floor((n mod 5)/2))^2 mod 7. - Victor Dumbrava, Jan 12 2018
G.f.: (1 + x + 4*x^2 + 4*x^3 + 2*x^4)/(1 - x^5). - Iain Fox, Jan 12 2018