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-10 of 12 results. Next

A028356 Simple periodic sequence underlying clock sequence A028354.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

From Klaus Brockhaus, May 15 2010: (Start)
Continued fraction expansion of (28+sqrt(2730))/56.
Decimal expansion of 1112/9009.
Partial sums of 1 followed by A130151.
First differences of A028357. (End)

References

  • Zdeněk Horský, "Pražský orloj" ("The Astronomical Clock of Prague", in Czech), Panorama, Prague, 1988, pp. 76-78.

Crossrefs

Cf. A177924 (decimal expansion of (28+sqrt(2730))/56), A130151 (repeat 1, 1, 1, -1, -1, -1), A028357 (partial sums of A028356). - Klaus Brockhaus, May 15 2010

Programs

  • Magma
    &cat [[1, 2, 3, 4, 3, 2]^^20]; // Klaus Brockhaus, May 15 2010
    
  • Maple
    A028356:=n->[1, 2, 3, 4, 3, 2][(n mod 6)+1]: seq(A028356(n), n=0..100); # Wesley Ivan Hurt, Jun 23 2016
  • Mathematica
    CoefficientList[ Series[(1 + 2x + 3x^2 + 4x^3 + 3x^4 + 2x^5)/(1 - x^6), {x, 0, 85}], x]
    LinearRecurrence[{1,0,-1,1},{1,2,3,4},120] (* or *) PadRight[{},120,{1,2,3,4,3,2}] (* Harvey P. Dale, Apr 15 2016 *)
  • Python
    def A028356(n): return (1,2,3,4,3,2)[n%6] # Chai Wah Wu, Apr 18 2024
  • Sage
    def A():
        a, b, c, d = 1, 2, 3, 4
        while True:
            yield a
            a, b, c, d = b, c, d, a + (d - b)
    A028356 = A(); [next(A028356) for n in range(106)] # Peter Luschny, Jul 26 2014
    

Formula

Sum of any six successive terms is 15.
G.f.: (1 + 2*x + 3*x^2 + 4*x^3 + 3*x^4 + 2*x^5)/(1 - x^6).
From Wesley Ivan Hurt, Jun 23 2016: (Start)
a(n) = a(n-1) - a(n-3) + a(n-4) for n>3.
a(n) = (15 - cos(n*Pi) - 8*cos(n*Pi/3))/6. (End)
E.g.f.: (15*exp(x) - exp(-x) - 8*cos(sqrt(3)*x/2)*(sinh(x/2) + cosh(x/2)))/6. - Ilya Gutkovskiy, Jun 23 2016
a(n) = abs(((n+3) mod 6)-3) + 1. - Daniel Jiménez, Jan 14 2023

Extensions

Additional comments from Robert G. Wilson v, Mar 01 2002

A158289 Period 18 zigzag sequence: repeat [0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1].

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5
Offset: 0

Views

Author

Jaroslav Krizek, Mar 15 2009

Keywords

Comments

A toothed or zigzag sequence.
Sequence contains only numbers 0..9; abs(a(n+1)-a(n)) = 1.
Decimal expansion of 12345679/1000000001. - Elmo R. Oliveira, Feb 20 2024

Crossrefs

Cf. A068073 (repeat 1,2,3,2), A028356 (repeat 1,2,3,4,3,2), A130784 (repeat 1,3,2).
Period k zigzag sequences: A000035 (k=2), A007877 (k=4), A260686 (k=6), A266313 (k=8), A271751 (k=10), A271832 (k=12), A279313 (k=14), A279319 (k=16), this sequence (k=18).

Programs

  • Magma
    [ s lt 9 select r else 9-r where r is n mod 9 where s is n mod 18: n in [0..104] ]; // Klaus Brockhaus, Sep 07 2009
    
  • Magma
    S:=[]; a:=0; for n in [0..104] do Append(~S, a); if n mod 18 eq 0 then d:=1; else if n mod 9 eq 0 then d:=-1; end if; end if; a+:=d; end for; S; // Klaus Brockhaus, Sep 07 2009
    
  • Magma
    &cat[[0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1]: n in [0..5]]; // Vincenzo Librandi, Jul 26 2015
    
  • Mathematica
    a[n_] := If[m = Mod[n, 18]; m <= 9, m, 18-m]; Table[a[n], {n, 0, 85}] (* Jean-François Alcover, Jul 19 2013 *)
    PadRight[{}, 100, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1}] (* Vincenzo Librandi, Jul 26 2015 *)
  • PARI
    a(n)=abs(n-round(n/18)*18) \\ M. F. Hasler, Jul 27 2015

Formula

a(18*k+j) = a(18*(k+1)-j) = j for k >= 0, j = 0..9.
G.f.: x*(1+x+x^2)*(1+x^3+x^6)/((1-x)*(1+x)*(1-x+x^2)*(1-x^3+x^6)). - Klaus Brockhaus, Sep 07 2009
a(n) = Sum_{i=0..n-1} (-1)^floor(i/9). - Wesley Ivan Hurt, Jul 25 2015
a(n) = abs(n - 18*round(n/18)). - Wesley Ivan Hurt, Dec 10 2016
a(n) = a(n-18) for n >= 18. - Wesley Ivan Hurt, Sep 07 2022

Extensions

Edited and extended by Klaus Brockhaus, Sep 07 2009

A186111 a(n) = -n if n odd, a(2n) = 3n if n odd, a(4n) = 2n.

Original entry on oeis.org

1, -3, 3, -2, 5, -9, 7, -4, 9, -15, 11, -6, 13, -21, 15, -8, 17, -27, 19, -10, 21, -33, 23, -12, 25, -39, 27, -14, 29, -45, 31, -16, 33, -51, 35, -18, 37, -57, 39, -20, 41, -63, 43, -22, 45, -69, 47, -24, 49, -75, 51, -26, 53, -81, 55, -28, 57, -87, 59, -30, 61, -93, 63
Offset: 1

Views

Author

Michael Somos, Feb 13 2011

Keywords

Examples

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

Crossrefs

Programs

  • Magma
    m:=25; R:=PowerSeriesRing(Integers(), m); Coefficients(R!(x*(1-x)^3*(1-x^3)/(1-x^4)^2)); // G. C. Greubel, Aug 14 2018
  • Mathematica
    Rest[CoefficientList[Series[x (1-x)^3(1-x^3)/(1-x^4)^2,{x,0,70}],x]] (* or *) LinearRecurrence[{-2,-3,-4,-3,-2,-1},{1,-3,3,-2,5,-9},70] (* Harvey P. Dale, Aug 08 2012 *)
    a[ n_] := n If[ OddQ[n], 1, -(Mod[n/2, 2] + 1/2)]; (* Michael Somos, Apr 25 2015 *)
    a[ n_] := n {1, -3/2, 1, -1/2}[[Mod[n, 4, 1]]]; (* Michael Somos, Apr 25 2015 *)
  • PARI
    {a(n) = -(-1)^n * n * [1, 2, 3, 2] [n%4 + 1] / 2};
    
  • PARI
    {a(n) = sign(n) * polcoeff( x * (1 - x)^3 * (1 - x^3) / (1 - x^4)^2 + x * O(x^abs(n)), abs(n))};
    
  • PARI
    {a(n) = n * if( n%2, 1, -(n/2%2 + 1/2))}; /* Michael Somos, Apr 25 2015 */
    

Formula

a(n) is multiplicative with a(2) = -3, a(2^e) = -(2^(e-1)) if e>1, a(p^e) = p^e if p>2.
Euler transform of length 4 sequence [-3, 0, -1, 2].
G.f.: x * (1 - x)^3 * (1 - x^3) / (1 - x^4)^2.
G.f.: x * (1 + x + x^2) * (1 - x)^2 / ((1 + x)^2 * (1 + x^2)^2).
Dirichlet g.f. zeta(s-1)*( 1-5*2^(-s)+4^(1-s)). - R. J. Mathar, Mar 31 2011
a(n) = (-1)^(n+1)*n + (-1)^floor(n/2)*A027656(n-2). - R. J. Mathar, Mar 31 2011
a(n) = -2*a(n-1) - 3*a(n-2) - 4*a(n-3) - 3*a(n-4) - 2*a(n-5) - a(n-6) with a(1)=1, a(2)=-3, a(3)=3, a(4)=-2, a(5)=5, a(6)=-9. - Harvey P. Dale, Aug 08 2012
G.f.: 1/(1+x) - 1/(1+x)^2 - 1/(1+x^2) + 1/(1+x^2)^2. - Michael Somos, Apr 24 2015
a(n) = -a(-n) for all n in Z. - Michael Somos, Apr 24 2015
G.f.: f(x) - f(x^2) where f(x) := x / (1 + x)^2. - Michael Somos, May 07 2015
Moebius transform of A186690. - Michael Somos, Apr 25 2015
a(n) = -(-1)^n * A186813(n). - Michael Somos, May 07 2015
a(n) = n*cos(n*Pi/2)/2-n*(-1)^n. - Wesley Ivan Hurt, May 05 2021

A186813 a(n) = n if n odd, a(2n) = 3n if n odd, a(4n) = 2n.

Original entry on oeis.org

0, 1, 3, 3, 2, 5, 9, 7, 4, 9, 15, 11, 6, 13, 21, 15, 8, 17, 27, 19, 10, 21, 33, 23, 12, 25, 39, 27, 14, 29, 45, 31, 16, 33, 51, 35, 18, 37, 57, 39, 20, 41, 63, 43, 22, 45, 69, 47, 24, 49, 75, 51, 26, 53, 81, 55, 28, 57, 87, 59, 30, 61, 93, 63, 32, 65, 99, 67, 34, 69, 105, 71, 36
Offset: 0

Views

Author

Michael Somos, Feb 27 2011

Keywords

Examples

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

Crossrefs

Cf. A187601. - Bruno Berselli, Mar 12 2011

Programs

  • Magma
    m:=25; R:=PowerSeriesRing(Integers(), m); Coefficients(R!(x*(1+x)*(1+x^3)/((1-x)*(1+x^2))^2)); // G. C. Greubel, Aug 14 2018
  • Mathematica
    CoefficientList[Series[x(1+x)(1+x^3)/((1-x)(1+x^2))^2,{x,0,80}],x] (* Harvey P. Dale, Mar 06 2011 *)
    a[ n_] := n/2 {2, 3, 2, 1}[[ Mod[ n, 4, 1]]]; (* Michael Somos, May 04 2015 *)
  • PARI
    {a(n) = n/2 * [1, 2, 3, 2][n%4 + 1]};
    
  • PARI
    {a(n) = sign(n) * polcoeff( x * (1 + x) * (1 + x^3) / ((1 - x) * (1 + x^2))^2 + x * O(x^abs(n)), abs(n))};
    

Formula

a(n) is multiplicative with a(2) = 3, a(2^e) = 2^(e-1) if e>1, a(p^e) = p^e if p>2.
Euler transform of length 6 sequence [3, -3, 1, 2, 0, -1].
G.f.: x * (1 + x) * (1 + x^3) / ((1 - x) * (1 + x^2))^2.
G.f.: x * (1 - x^2)^3 * (1 - x^6) / ((1 - x)^3 * (1 - x^3) * (1 - x^4)^2). - Michael Somos, May 04 2015
G.f.: f(x) - f(-x^2) where f(x) := x/(1-x)^2. - Michael Somos, May 04 2015
a(n) = -a(-n) for all n in Z. a(n) = n/2 * A068073(n).
a(n) = n*(4-i^n-(-i)^n)/4 with i=sqrt(-1). - Bruno Berselli, Mar 10 2011
a(n) = A134172(n) + A134172(n+1). - Michael Somos, May 04 2015
a(n) = -(-1)^n * A186111(n). - Michael Somos, May 07 2015
a(n) = n - n*cos(n*Pi/2)/2. - Wesley Ivan Hurt, May 05 2021
Dirichlet g.f.: zeta(s-1) * (1 + 1/2^s - 1/4^(s-1)). - Amiram Eldar, Oct 26 2023

A292576 Permutation of the natural numbers partitioned into quadruples [4k-1, 4k-3, 4k-2, 4k], k > 0.

Original entry on oeis.org

3, 1, 2, 4, 7, 5, 6, 8, 11, 9, 10, 12, 15, 13, 14, 16, 19, 17, 18, 20, 23, 21, 22, 24, 27, 25, 26, 28, 31, 29, 30, 32, 35, 33, 34, 36, 39, 37, 38, 40, 43, 41, 42, 44, 47, 45, 46, 48, 51, 49, 50, 52, 55, 53, 54, 56, 59, 57, 58, 60, 63, 61, 62
Offset: 1

Views

Author

Guenther Schrack, Sep 19 2017

Keywords

Comments

Partition the natural number sequence into quadruples starting with (1,2,3,4); swap the second and third elements, then swap the first and the second element; repeat for all quadruples.

Crossrefs

Inverse: A056699(n+1) - 1 for n > 0.
Sequence of fixed points: A008586(n) for n > 0.
Subsequences:
elements with odd index: A042964(A103889(n)) for n > 0.
elements with even index: A042948(n) for n > 0.
odd elements: A166519(n) for n>0.
indices of odd elements: A042963(n) for n > 0.
even elements: A005843(n) for n>0.
indices of even elements: A014601(n) for n > 0.
Sum of pairs of elements:
a(n+2) + a(n) = A163980(n+1) = A168277(n+2) for n > 0.
Difference between pairs of elements:
a(n+2) - a(n) = (-1)^A011765(n+3)*A091084(n+1) for n > 0.
Compound relations:
a(n) = A284307(n+1) - 1 for n > 0.
a(n+2) - 2*a(n+1) + a(n) = (-1)^A011765(n)*A132400(n+1) for n > 0.
Compositions:
a(n) = A116966(A080412(n)) for n > 0.
a(A284307(n)) = A256008(n) for n > 0.
a(A042963(n)) = A166519(n-1) for n > 0.
A256008(a(n)) = A056699(n) for n > 0.

Programs

  • MATLAB
    a = [3 1 2 4]; % Generate b-file
    max = 10000;
    for n := 5:max
       a(n) = a(n-4) + 4;
    end;
    
  • PARI
    for(n=1, 10000, print1(n + ((-1)^(n*(n-1)/2)*(2 - (-1)^n) - (-1)^n)/2, ", "))

Formula

a(1)=3, a(2)=1, a(3)=2, a(4)=4, a(n) = a(n-4) + 4 for n > 4.
O.g.f.: (2*x^3 + x^2 - 2*x + 3)/(x^5 - x^4 - x + 1).
a(n) = n + ((-1)^(n*(n-1)/2)*(2-(-1)^n) - (-1)^n)/2.
a(n) = n + (cos(n*Pi/2) - cos(n*Pi) + 3*sin(n*Pi/2))/2.
a(n) = n + n mod 2 + (ceiling(n/2)) mod 2 - 2*(floor(n/2) mod 2).
Linear recurrence: a(n) = a(n-1) + a(n-4) - a(n-5) for n>5.
First Differences, periodic: (-2, 1, 2, 3), repeat; also (-1)^A130569(n)*A068073(n+2) for n > 0.

A047401 Numbers that are congruent to {0, 1, 3, 6} mod 8.

Original entry on oeis.org

0, 1, 3, 6, 8, 9, 11, 14, 16, 17, 19, 22, 24, 25, 27, 30, 32, 33, 35, 38, 40, 41, 43, 46, 48, 49, 51, 54, 56, 57, 59, 62, 64, 65, 67, 70, 72, 73, 75, 78, 80, 81, 83, 86, 88, 89, 91, 94, 96, 97, 99, 102, 104, 105, 107, 110, 112, 113, 115, 118, 120, 121, 123
Offset: 1

Views

Author

Keywords

Comments

Partial sums of A068073. - Jeremy Gardiner, Jul 20 2013.

Crossrefs

Programs

  • Magma
    [n : n in [0..150] | n mod 8 in [0, 1, 3, 6]]; // Wesley Ivan Hurt, Jun 01 2016
    
  • Maple
    A047401:=n->2*(n-1)+(I^(n*(n-1))-1)/2: seq(A047401(n), n=1..100); # Wesley Ivan Hurt, Jun 01 2016
  • Mathematica
    Select[Range[0,107], MemberQ[{0, 1, 3, 6}, Mod[#, 8]]&] (* Bruno Berselli, Dec 05 2011 *)
  • Maxima
    makelist(2*(n-1)+(%i^(n*(n-1))-1)/2,n,1,55); /* Bruno Berselli, Dec 05 2011 */
    
  • PARI
    my(x='x+O('x^100)); concat(0, Vec(x^2*(1+x+2*x^2)/((x^2+1)*(x-1)^2))) \\ Altug Alkan, Jun 02 2016

Formula

G.f.: x^2*(1+x+2*x^2) / ( (x^2+1)*(x-1)^2 ). - R. J. Mathar, Dec 05 2011
a(n) = 2*(n-1)+(i^(n*(n-1))-1)/2, where i=sqrt(-1). - Bruno Berselli, Dec 05 2011
From Wesley Ivan Hurt, Jun 01 2016: (Start)
a(n) = 2*a(n-1) - 2*a(n-2) + 2*a(n-3) - a(n-4) for n>4.
a(2k) = A047452(k), a(2k-1) = A047470(k). (End)
Sum_{n>=2} (-1)^n/a(n) = Pi/16 + (3-sqrt(2))*log(2)/8 + sqrt(2)*log(2+sqrt(2))/4. - Amiram Eldar, Dec 20 2021

A164356 Expansion of (1 - x^2)^4 / ((1 - x)^4 * (1 - x^4)) in powers of x.

Original entry on oeis.org

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

Views

Author

Michael Somos, Aug 13 2009

Keywords

Examples

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

Crossrefs

Cf. A068073.

Programs

  • Mathematica
    a[ n_] := -Boole[n == 0] + 4 - If[ EvenQ[n], (-1)^(n/2) 2, 0]; (* Michael Somos, Apr 17 2015 *)
    a[ n_] := SeriesCoefficient[ -1 + 4/(1 - x) - 2/(1 + x^2), {x, 0, Abs@n}]; (* Michael Somos, Jan 07 2019 *)
    LinearRecurrence[{1,-1,1},{1,4,6,4},120] (* or *) PadRight[{1},120,{2,4,6,4}] (* Harvey P. Dale, Aug 30 2024 *)
  • PARI
    {a(n) = -(n==0) + 4 - if( n%2 == 0, (-1)^(n/2) * 2, 0)};

Formula

Euler transform of length 4 sequence [4, -4, 0, 1].
Moebius transform is length 4 sequence [4, 2, 0, -4].
a(n) = 4 * b(n) unless n=0 and b(n) is multiplicative with b(2) = 3/2, b(2^e) = 1/2 if e>1, b(p^e) = 1 if p>2.
a(n) = a(-n) for all n in Z. a(n+4) = a(n) unless n=0 or n=-4. a(2*n + 1) = 4. a(4*n) = 2 unless n=0. a(4*n + 2) = 6.
G.f.: -1 + 4 / (1 - x) - 2 / (1 + x^2).
a(n) = 2 * A068073(n) unless n=0. - Michael Somos, Apr 17 2015

A177033 Decimal expansion of (2+sqrt(14))/4.

Original entry on oeis.org

1, 4, 3, 5, 4, 1, 4, 3, 4, 6, 6, 9, 3, 4, 8, 5, 3, 4, 6, 3, 9, 5, 9, 3, 7, 1, 8, 3, 0, 7, 9, 1, 3, 7, 3, 2, 5, 4, 3, 9, 0, 0, 4, 9, 5, 1, 9, 4, 4, 6, 8, 1, 7, 3, 6, 5, 7, 5, 9, 3, 6, 3, 6, 6, 8, 3, 0, 0, 0, 8, 7, 8, 9, 0, 7, 6, 7, 3, 4, 7, 5, 6, 9, 9, 4, 2, 0, 2, 4, 7, 3, 7, 9, 8, 5, 9, 4, 8, 9, 2, 8, 7, 5, 2, 4
Offset: 1

Views

Author

Klaus Brockhaus, May 01 2010

Keywords

Comments

Continued fraction expansion of (2+sqrt(14))/4 is A068073.

Examples

			(2+sqrt(14))/4 = 1.43541434669348534639...
		

Crossrefs

Cf. A010471 (decimal expansion of sqrt(14)), A068073 (repeat 1, 2, 3, 2).

Programs

  • Mathematica
    RealDigits[(2+Sqrt[14])/4,10,120][[1]] (* Harvey P. Dale, Jul 18 2011 *)

A298364 Permutation of the natural numbers partitioned into quadruples [4k-2, 4k-1, 4k-3, 4k] for k > 0.

Original entry on oeis.org

2, 3, 1, 4, 6, 7, 5, 8, 10, 11, 9, 12, 14, 15, 13, 16, 18, 19, 17, 20, 22, 23, 21, 24, 26, 27, 25, 28, 30, 31, 29, 32, 34, 35, 33, 36, 38, 39, 37, 40, 42, 43, 41, 44, 46, 47, 45, 48, 50, 51, 49, 52, 54, 55, 53, 56, 58, 59, 57, 60, 62, 63, 61, 64, 66, 67, 65
Offset: 1

Views

Author

Guenther Schrack, Jan 18 2018

Keywords

Comments

Partition the natural number sequence into quadruples starting with (1,2,3,4); swap the first and second elements, then swap the second and third elements; repeat for all quadruples.

Crossrefs

Inverse: A292576.
Sequence of fixed points: A008586(n) for n > 0.
First differences: (-1)^floor(n^2/4)*A068073(n-1) for n > 0.
Subsequences:
elements with odd index: A042963(A103889(n)) for n > 0.
elements with even index A014601(n) for n > 0.
odd elements: A166519(n-1) for n > 0.
indices of odd elements: A042964(n) for n > 0.
even elements: A005843(n) for n > 0.
indices of even elements: A042948(n) for n > 0.
Other similar permutations: A116966, A284307, A292576.

Programs

  • MATLAB
    a = [2 3 1 4];
    max = 10000;    % Generation of b-file.
    for n := 5:max
       a(n) = a(n-4) + 4;
    end;
    
  • Mathematica
    Nest[Append[#, #[[-4]] + 4] &, {2, 3, 1, 4}, 63] (* or *)
    Array[# + ((-1)^# + ((-1)^(# (# - 1)/2)) (1 - 2 (-1)^#))/2 &, 67] (* Michael De Vlieger, Jan 23 2018 *)
    LinearRecurrence[{1,0,0,1,-1},{2,3,1,4,6},70] (* Harvey P. Dale, Dec 12 2018 *)
  • PARI
    for(n=1, 100, print1(n + ((-1)^n + ((-1)^(n*(n-1)/2))*(1 - 2*(-1)^n))/2, ", "))

Formula

O.g.f.: (3*x^3 - 2*x^2 + x + 2)/(x^5 - x^4 - x - 1).
a(1) = 2, a(2) = 3, a(3) = 1, a(4) = 4, a(n) = a(n-4) + 4 for n > 4.
a(n) = n + ((-1)^n + ((-1)^(n*(n-1)/2))*(1 - 2*(-1)^n))/2.
a(n) = n + (cos(n*Pi) - cos(n*Pi/2) + 3*sin(n*Pi/2))/2.
a(n) = 2*floor((n+1)/2) - 4*floor((n+1)/4) + floor(n/2) + 2*floor(n/4).
a(n) = n + (-1)^floor((n-1)^2/4)*A140081(n) for n > 0.
a(n) = A056699(n+1) - 1, n > 0.
a(n+2) = A168269(n+1) - a(n), n > 0.
a(n+2) = a(n) + (-1)^floor((n+1)^2/4)*A132400(n+2) for n > 0.
Linear recurrence: a(n) = a(n-1) + a(n-4) - a(n-5) for n > 5.
First differences: periodic, (1, -2, 3, 2) repeat.
Compositions:
a(n) = A080412(A116966(n-1)) for n > 0.
a(n) = A284307(A256008(n)) for n > 0.
a(A067060(n)) = A133256(n) for n > 0.
A116966(a(n+1)-1) = A092486(n) for n >= 0.
A056699(a(n)) = A256008(n) for n > 0.

A164360 Period 3: repeat [5, 4, 3].

Original entry on oeis.org

5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3
Offset: 0

Views

Author

Stephen Crowley, Aug 14 2009

Keywords

Comments

From Klaus Brockhaus, May 29 2010: (Start)
Continued fraction expansion of (32+sqrt(1297))/13.
Decimal expansion of 181/333. (End)

Crossrefs

Cf. A007877 (repeat 0,1,2,1), A068073 (repeat 1,2,3,2), A028356 (repeat 1,2,3,4,3,2), A130784 (repeat 1,3,2), A158289 (repeat 0,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3,2,1).
Cf. A178566 (decimal expansion of (32+sqrt(1297))/13). [Klaus Brockhaus, May 29 2010]

Programs

Formula

a(n) = 4+(-1)^n*((1/2+I*sqrt(3)/6)*((1+I*sqrt(3))/2)^n+(1/2-I*sqrt(3)/6)*((1-I*sqrt(3))/2)^n). [Corrected by Klaus Brockhaus, Sep 17 2009]
a(n) = 4+(1/3)*sqrt(3)*sin(2*n*Pi/3)+cos(2*n*Pi/3). [Corrected by Klaus Brockhaus, Sep 17 2009]
a(n) = a(n-3) for n > 2, with a(0) = 5, a(1) = 4, a(2) = 3.
G.f.: (5+4*x+3*x^2)/((1-x)*(1+x+x^2)). [Klaus Brockhaus, Sep 17 2009]
E.g.f.: 4*exp(x)+(1/3)*sqrt(3)*exp(-(1/2)*x)*sin((1/2)*x*sqrt(3))+exp(-(1/2)*x)*cos((1/2)*x*sqrt(3)).
a(n) = 4 + A057078(n). - Wesley Ivan Hurt, Jul 01 2016

Extensions

Edited by Klaus Brockhaus, Sep 17 2009
Offset changed to 0 and formulas adjusted by Klaus Brockhaus, May 18 2010
Showing 1-10 of 12 results. Next