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.

A037610 Decimal expansion of a(n) is given by the first n terms of the periodic sequence with initial period 1,2,3.

Original entry on oeis.org

1, 12, 123, 1231, 12312, 123123, 1231231, 12312312, 123123123, 1231231231, 12312312312, 123123123123, 1231231231231, 12312312312312, 123123123123123, 1231231231231231, 12312312312312312, 123123123123123123, 1231231231231231231, 12312312312312312312
Offset: 1

Views

Author

Keywords

Comments

Periodic sequences of this type can be easily calculated by a(n) = floor(q*10^n/(10^m-1)), where q is the number representing the periodic digit pattern (=123 for this sequence) and m is the period length. - Hieronymus Fischer Jan 03 2013

Programs

  • Magma
    [(41*10^n-27*n-50+90*Floor(n/3)-9*Floor((n-1)/3))/333: n in [1..30]]; // Bruno Berselli, Sep 13 2018
  • Maple
    A037610:=n->floor((41/333)*10^n); seq(A037610(n), n=1..20); # Wesley Ivan Hurt, Apr 19 2014
  • Mathematica
    a[n_] := Floor[41/333*10^n]; Array[a, 19] (* Robert G. Wilson v, Apr 18 2014 *)
    Table[FromDigits[PadRight[{},n,{1,2,3}]],{n,20}] (* or *) LinearRecurrence[ {10,0,1,-10},{1,12,123,1231},20] (* Harvey P. Dale, May 09 2014 *)
  • PARI
    A037610(n)=10^n*41\333  \\ M. F. Hasler, Jan 13 2013
    
  • PARI
    Vec(x*(3*x^2+2*x+1)/((x-1)*(10*x-1)*(x^2+x+1)) + O(x^100)) \\ Colin Barker, Apr 30 2014
    

Formula

a(n) = floor((41/333)*10^n). - Hieronymus Fischer, Jan 03 2013
From Colin Barker, Apr 30 2014: (Start)
a(n) = 10*a(n-1) + a(n-3) - 10*a(n-4).
G.f.: x*(3*x^2 + 2*x + 1) / ((x - 1)*(10*x - 1)*(x^2 + x + 1)). (End)
a(n) = (41*10^n - 27*n - 50 + 90*floor(n/3) - 9*floor((n - 1)/3))/333. - Bruno Berselli, Sep 13 2018