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.

A068073 Period 4 sequence [ 1, 2, 3, 2, ...].

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, Mar 01 2002

Keywords

Comments

Continued fraction expansion of (2+sqrt(14))/4. - Klaus Brockhaus, May 01 2010
The sequence is like a sawtooth wave of period 4. - Michael Somos, Feb 13 2011

Examples

			G.f. = 1 + 2*x + 3*x^2 + 2*x^3 + x^4 + 2*x^5 + 3*x^6 + 2*x^7 + x^8 + 2*x^9 + ...
		

Crossrefs

Cf. A177033 (decimal expansion of (2+sqrt(14))/4). - Klaus Brockhaus, May 01 2010

Programs

  • Mathematica
    CoefficientList[ Series[(1 + 2x + 3x^2 + 2x^3)/(1 - x^4), {x, 0, 85}], x]
    a[ n_] := {2, 3, 2, 1}[[Mod[n, 4, 1]]]; (* Michael Somos, Apr 17 2015 *)
    PadRight[{},120,{1,2,3,2}] (* Harvey P. Dale, Jun 13 2020 *)
  • PARI
    {a(n) = [1, 2, 3, 2] [n%4 + 1]}; /* Michael Somos, Feb 13 2011 */
    
  • PARI
    {a(n) = n%4 + 1 - 2 * (n%4 == 3)}; /* Michael Somos, Feb 13 2011 */
    
  • PARI
    {a(n) = 2 + kronecker( -4, n-1)}; /* Michael Somos, Feb 13 2011 */

Formula

G.f.: (1 + 2*x + 3*x^2 + 2*x^3) / (1 - x^4).
Conjecture: a(n) = Sum_{k=0..n} e^(i*Pi*(A000120(A001045(n)) - A001045(A000120(n)))), i=sqrt(-1). - Paul Barry, Jan 14 2005
From Paul Barry, Jan 14 2005: (Start)
G.f.: (1 + x + 2x^2)/(1 - x + x^2 - x^3);
a(n) = 2 - cos(Pi*n/2). (End)
Moebius transform is length 4 sequence [2, 1, 0, -2]. - Michael Somos, Feb 13 2011
a(n) = 2 - A056594(n). - Bruno Berselli, Mar 10 2011
a(n) = a(-n) = a(n+4) for all n in Z. - Michael Somos, Apr 17 2015
2 * a(n) = A164356(n) unless n=0. - Michael Somos, Apr 17 2015
G.f.: 1 / (1 - 2*x / (1 + x / (2 - 5*x / (1 + 16*x / (5 - x))))). - Michael Somos, Jan 20 2017
G.f.: 2 / (1 - x) - 1 / (1 + x^2). - Michael Somos, Jan 07 2019
a(n) = abs(((n+2) mod 4)-2) + 1. - Daniel Jiménez, Jan 14 2023