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-3 of 3 results.

A007877 Period 4 zigzag sequence: repeat [0,1,2,1].

Original entry on oeis.org

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

Views

Author

Christopher Lam Cham Kee (Topher(AT)CyberDude.Com)

Keywords

Comments

Euler transform of finite sequence [2,-2,0,1]. - Michael Somos, Sep 17 2004
This is the r = 2 member in the r-family of sequences S_r(n) defined in A092184 where more information can be found.
a(n+1) is the transform of sqrt(1+2x)/sqrt(1-2x) (A063886) under the Chebyshev transformation A(x) -> (1/(1 + x^2))A(x/(1 + x^2)). See also A084099. - Paul Barry, Oct 12 2004
Multiplicative with a(2) = 2, a(2^e) = 0 if e >= 2, a(p^e) = 1 otherwise. - David W. Wilson, Jun 12 2005
The e.g.f. of 1, 2, 1, 0, 1, 2, 1, 0, ... (shifted left, offset zero) is exp(x) + sin(x).
Binomial transform is A000749(n+2). - Wesley Ivan Hurt, Dec 30 2015
Decimal expansion of 11/909. - David A. Corneth, Dec 12 2016
Ternary expansion of 1/5. - J. Conrad, Aug 14 2017

Crossrefs

Period k zigzag sequences: A000035 (k=2), this sequence (k=4), A260686 (k=6), A266313 (k=8), A271751 (k=10), A271832 (k=12), A279313 (k=14), A279319 (k=16), A158289 (k=18).

Programs

  • Magma
    &cat [[0,1,2,1]^^25]; // Vincenzo Librandi, Dec 27 2015
    
  • Maple
    A007877:=n->sqrt(n^2 mod 8); seq(A007877(n), n=0..100); # Wesley Ivan Hurt, Jan 01 2014
  • Mathematica
    f[n_] := Mod[n, 4] - Mod[n^3, 4] + Mod[n^2, 4] (* Or *)
    f[n_] := Mod[n, 2] + 2 Floor[Mod[n + 1, 4]/3] (* Or *)
    f[n_] := Switch[Mod[n, 4], 0, 0, 1, 1, 2, 2, 3, 1]; Array[f, 105, 0] (* Robert G. Wilson v, Aug 08 2011 *)
    Table[Sqrt[Mod[n^2,8]], {n,0,100}] (* Wesley Ivan Hurt, Jan 01 2014 *)
    LinearRecurrence[{1, -1, 1}, {0, 1, 2}, 80] (* Vincenzo Librandi, Dec 27 2015 *)
    PadRight[{},100,{0,1,2,1}] (* Harvey P. Dale, Oct 24 2023 *)
  • PARI
    a(n)=[0,1,2,1][1+n%4] \\ Jaume Oliver Lafont, Mar 27 2009
    
  • PARI
    concat(0, Vec(x*(1+x)/(1-x+x^2-x^3) + O(x^100))) \\ Altug Alkan, Dec 29 2015
    
  • Python
    def A007877(n): return (0,1,2,1)[n&3] # Chai Wah Wu, Jan 26 2023

Formula

Multiplicative with a(p^e) = 2 if p = 2 and e = 0; 0 if p = 2 and e > 0; 1 if p > 2. - David W. Wilson, Aug 01 2001
a(n) = -Sum_{k=0..n} (-1)^C(k+2, 2) (Offset -1). - Paul Barry, Jul 07 2003
a(n) = 1 - cos(n*Pi/2); a(n) = a(n-1) - a(n-2) + a(n-3) for n>2. - Lee Reeves (leereeves(AT)fastmail.fm), May 10 2004
a(n) = -a(n-2) + 2, n >= 2, a(0) = 0, a(1) = 1.
G.f.: x*(1+x)/((1-x)*(1+x^2)) = x*(1+x)/(1-x+x^2-x^3).
a(n) = 1 - T(n, 0) = 1 - A056594(n) with Chebyshev's polynomials T(n, x) of the first kind. Note that T(n, 0) = S(n, 0).
a(n) = b(n) + b(n-1), n >= 1, with b(n) := A021913(n+1) the partial sums of S(n,0) = U(n,0) = A056594(n) (Chebyshev's polynomials evaluated at x=0).
a(n) = 1 + (1/2){(-1)^[(n-1)/2] - (-1)^[n/2]}. - Ralf Stephan, Jun 09 2005
Non-reduced g.f.: x*(1+x)^2/(1-x^4). - Jaume Oliver Lafont, Mar 27 2009
a(n+1) = (S(n, sqrt(2)))^2, n >= 0, with the Chebyshev S-polynomials A049310. See the W. Lang link under A181878. - Wolfdieter Lang, Dec 15 2010
Dirichlet g.f. (1 + 1/2^s - 2/4^s)*zeta(s). - R. J. Mathar, Feb 24 2011
a(n) = (n mod 4) - (n^3 mod 4) + (n^2 mod 4). - Gary Detlefs, Apr 17 2011
a(n) = (n mod 2) + 2*floor(((n+1) mod 4)/3). - Gary Detlefs, Jul 19 2011
a(n) = sqrt(n^2 mod 8). - Wesley Ivan Hurt, Jan 01 2014
a(n) = (n AND 4*k+2)-(n AND 4*k+1) + 2*floor(((n+2) mod 4)/3), for any k. - Gary Detlefs, Jun 08 2014
a(n) = Sum_{i=1..n} (-1)^floor((i-1)/2). - Wesley Ivan Hurt, Dec 26 2015
a(n) = a(n-4) for n >= 4. - Wesley Ivan Hurt, Sep 07 2022
a(n) = n - 2*floor(n/4) - 2*floor((n+1)/4). - Ridouane Oudra, Jan 22 2024
E.g.f.: exp(x) - cos(x). - Stefano Spezia, Aug 04 2025

Extensions

Chebyshev comments from Wolfdieter Lang, Sep 10 2004

A158454 Riordan array (1/(1-x^2), x/(1+x)^2).

Original entry on oeis.org

1, 0, 1, 1, -2, 1, 0, 4, -4, 1, 1, -6, 11, -6, 1, 0, 9, -24, 22, -8, 1, 1, -12, 46, -62, 37, -10, 1, 0, 16, -80, 148, -128, 56, -12, 1, 1, -20, 130, -314, 367, -230, 79, -14, 1, 0, 25, -200, 610, -920, 771, -376, 106, -16, 1, 1, -30, 295, -1106, 2083, -2232, 1444, -574, 137, -18, 1
Offset: 0

Views

Author

Paul Barry, Mar 19 2009

Keywords

Comments

Coefficient table of the square of Chebyshev S-polynomials. For the S-polynomials see A049310, and for a proof see the array A181878, where the odd numbered rows are shifted by one to the left. - Wolfdieter Lang, Dec 15 2010
Image of the Catalan numbers A000108 by this matrix is the all 1's sequence.
Image of the central binomial numbers A000984 by this matrix is the counting numbers A000027.
Inverse array is the Riordan array (1-x^2*c(x)^4, xc(x)^2), where c(x) is the g.f. of A000108.
The row polynomials R(n, x) = Sum_{k=0..n} T(n, k)*x^k belong to the class of Boas-Buck polynomials. Hence they satisfy the Boas-Buck identity: (E_x - n*1)*R(n, x) = -Sum_{p=0..n-1} ((1 - (-1)^p)*1 + 2*(-1)^(p+1)*E_x) R(n-1-p, x) for n >= 0. See the Boas-Buck comments and references in A046521. The ensuing recurrence for the column sequences is given in the formula section. - Wolfdieter Lang, Aug 10 2017

Examples

			The triangle T(n,k) begins:
  n\k  0   1    2     3     4      5     6     7    8    9  10...
  0:   1
  1:   0   1
  2:   1  -2    1
  3:   0   4   -4     1
  4:   1  -6   11    -6     1
  5:   0   9  -24    22    -8      1
  6:   1 -12   46   -62    37    -10     1
  7:   0  16  -80   148  -128     56   -12     1
  8:   1 -20  130  -314   367   -230    79   -14    1
  9:   0  25 -200   610  -920    771  -376   106  -16    1
  10:  1 -30  295 -1106  2083  -2232  1444  -574  137  -18   1
  ... Reformatted and extended by _Wolfdieter Lang_, Nov 24 2012
Recurrences (from A- and Z-sequences):
  1 = T(6,0) = 0*0 + 1*9 +2*(-24) + 5*22 + 14*(-8)+ 42*1.
-80 = T(7,2) = 1*(-12) -2*(46) -1*(-62) -2*37 -5*(-10) -14*1. - _Wolfdieter Lang_, Dec 20 2010
		

References

  • Kenneth Edwards, Michael A. Allen, A new combinatorial interpretation of the Fibonacci numbers squared, Part II, Fib. Q., 58:2 (2020), 169-177.

Crossrefs

From Wolfdieter Lang, Aug 10 2017: (Start)
Row sums A011655(n+1), alternating row sums A007598(n+1)*(-1)^(n+1).
Column sequences k=0..5: A059841, A002620(n+2)*(-1)^(n), A001752(n)*(-1)^n, A001769(n)*(-1)^n, A001780(n)*(-1)^n, A001786(n)*(-1)^n. (End)

Programs

  • GAP
    T:=Flat(List([0..10], n->List([0..n], k->Sum([0..n], j-> (-1)^(j-k)*Binomial(k+j, 2*k))))); # G. C. Greubel, Dec 15 2018
  • Magma
    [[(&+[(-1)^(j-k)*Binomial(k+j, 2*k): j in [0..n]]): k in [0..n]]: n in [0..10]]; // G. C. Greubel, Dec 15 2018
    
  • Maple
    A158454 := proc(n,k) (-1)^(n+k)*add(binomial(n+k-1-2*j,2*k-1),j=0..floor(n/2)) ; end proc;
    seq(seq(A158454(n,k),k=0..n),n=0..10) ; # R. J. Mathar, Dec 17 2010
  • Mathematica
    nmax = 10; t[n_, k_] := (-1)^(n+k)* Sum[Binomial[n+k-1-2*j, 2*k-1], {j, 0, Floor[n/2]}]; t[n_?EvenQ, 0] = 1; Flatten[ Table[ t[n, k], {n, 0, nmax}, {k, 0, n}]] (* Jean-François Alcover, Nov 08 2011, after Maple *)
    With[{m = 15}, CoefficientList[CoefficientList[Series[(1+x)/((1-x)*(1 + x)^2 -t*x*(1-x)), {x, 0, m}, {t, 0, m}], x], t]]//Flatten (* G. C. Greubel, Dec 15 2018 *)
    T[n_, 0] := Boole[EvenQ[n]]; T[n_, k_] := (-1)^(n - k) Binomial[k+n-1, 2*k-1] HypergeometricPFQ[{1, (k - n)/2, (1 + k - n)/2}, {(1 - k - n)/2, (2 - k - n)/2}, 1]; Table[T[n, k], {n, 0, 9}, {k, 0, n}] // TableForm  (* Peter Luschny, Aug 20 2022 *)
  • PARI
    {T(n,k) = sum(j=0,n, (-1)^(j-k)*binomial(k+j, 2*k))};
    for(n=0, 10, for(k=0,n, print1(T(n,k), ", "))) \\ G. C. Greubel, Dec 15 2018
    
  • Sage
    [[sum((-1)^(j-k)*binomial(k+j, 2*k) for j in range(n+1)) for k in range(n+1)] for n in range(10)] # G. C. Greubel, Dec 15 2018
    

Formula

Number triangle T(n, k) = Sum_{j=0..n} (-1)^(j-k)*binomial(k+j, 2*k) = Sum_{j=0..n-k} (-1)^(n-k-j)*binomial(n+k-j, 2*k).
O.g.f. column k with leading zeros (Riordan array, see NAME): (1/(1-x^2))*(x/(1+x)^2)^k, k >= 0. - Wolfdieter Lang, Dec 15 2010
T(n, k) = (-1)^(n-k)*Sum_{j=0..floor(n/2)} binomial(n+k-1-2*j, 2*k-1), 0 <= k <= n, else 0. From the o.g.f. for column k after convolution. - Wolfdieter Lang, Dec 17 2010
O.g.f. row polynomials (rising powers in y): ((1+x)/(1-x))/(1+(2-y)*x+x^2) = Sum_{n>=0} S(n,sqrt(y))^2*x^n, with Chebyshev S-polynomials from A049310. - Wolfdieter Lang, Dec 15 2010
Recurrences from the A- and Z-sequences for Riordan arrays. See the W. Lang link under A006232 for details and references.
T(n, 0) = Sum_{j=0..n-1} Z(j)*T(n-1, j), n >= 1.
T(n, k) = Sum_{j=0..n-k} A(j)*T(n-1, k-1+j), n >= k >= 1.
Here Z(0)=0 and Z(j) = A000108(j), j >= 1, (o.g.f. -1 + c(x), with the Catalan o.g.f. c(x)), and A(j) = A115141(j) = [1,-2,-1,-2,-5,-14,...], j >= 0, with o.g.f. 1/c(x)^2. - Wolfdieter Lang, Dec 20 2010
T(n, k) = Sum_{m=0..n} A129818(m, k), 0 <= k <= n. - Wolfdieter Lang, Dec 15 2010
Boas-Buck recurrence for column k: R(n, k) = (1/(n-k))*Sum_{p=k..n-1}((-1)^(n-p)*(2*k+1) + 1) * R(p, k), for n > k >= 0, with input R(k, k) = 1. See a comment above. - Wolfdieter Lang, Aug 10 2017
G.f.: (1 + x)/((1 - x)*(1 + x)^2 - t*x*(1 - x)). - G. C. Greubel, Dec 15 2018
T(n, k) = (-1)^(n - k)*binomial(k + n - 1, 2*k-1)*hypergeom([1, (k - n)/2, (1 + k - n)/2], [(1 - k - n)/2, (2 - k - n)/2], 1) for k >= 1 . - Peter Luschny, Aug 20 2022

A219234 Coefficient array for the fourth power of Chebyshev's S-polynomials as a function of x^2.

Original entry on oeis.org

1, 0, 0, 1, 1, -4, 6, -4, 1, 0, 0, 16, -32, 24, -8, 1, 1, -12, 58, -144, 195, -144, 58, -12, 1, 0, 0, 81, -432, 972, -1200, 886, -400, 108, -16, 1, 1, -24, 236, -1228, 3678, -6612, 7490, -5532, 2701, -864, 174, -20, 1, 0, 0, 256, -2560, 11136, -27776, 44176, -47232, 34912, -18048, 6504, -1600, 256, -24, 1
Offset: 0

Views

Author

Wolfdieter Lang, Nov 28 2012

Keywords

Comments

The row lengths sequence for this array is 2*n+1, given in A005408.
The coefficient triangle for the monic Chebyshev S-polynomials S(n,x) = U(n,x/2) are given in A049310.
The coefficients for S(n,x)^2 are given in A158454 and in A181878 (odd numbered rows shifted by one unit to the left).

Examples

			The irregular triangle a(n, m) starts:
n\m  0   1   2     3    4     5    6     7    8    9  10  11 12
0:   1
1:   0   0   1
2:   1  -4   6    -4    1
3:   0   0  16   -32   24    -8    1
4:   1 -12  58  -144  195  -144   58   -12    1
5:   0   0  81  -432  972 -1200  886  -400  108  -16   1
6:   1 -24 236 -1228 3678 -6612 7490 -5532 2701 -864 174 -20  1
...
Row n=7: [0, 0, 256, -2560, 11136, -27776, 44176, -47232, 34912, -18048, 6504, -1600, 256, -24, 1].
Row n=8: [1, -40, 660, -5828, 30194, -96780, 203374, -293464, 300231, -222112, 119938, -47244, 13415, -2672, 354, -28, 1].
Row n=1 polynomial p(1,x) = 1*x^2 = S(1,sqrt(x))^4 = (sqrt(x))^4.
Row n=2 polynomial p(2,x) = 1 - 4*x + 6*x^2 - 4*x^3 + 1*x^4 =
  S(2,sqrt(x))^4 = (-1+x)^4.
		

Crossrefs

Formula

a(n, m) = [x^(2*m)] S(n, x)^4, n >= 0, with the monic Chebyshev S-polynomials given in terms of the U-polynomials in a comment above.
The o.g.f. GS4(x, z) := sum((S(n, x)^4)*z^n,n=0..infinity) = ((1+z)/(1-z))*(1 - (2-3*x^2)*z + z^2)/((1-z*(-2+x^2)+z^2)*(1-z*(2-4*x^2+x^4)+z^2)). For the o.g.f. of the row polynomials p(n,x) :=sum(a(n,m)*x^m,m=0..n) take GS4(sqrt(x), z).
The row polynomial p(n, x^2) = Sum_{m=0..2*n} a(n, m)*x^(2*m) = (S(n, x))^4 = (R(4*(n+1), x) - 4*R(2*(n+1), x) + 6)/(x^2 - 4)^2, where R are the monic Chebyshev T polynomials with coefficients given in A127672. For factorizations of the S polynomials see comments on A049310. - Wolfdieter Lang, Apr 09 2018
Showing 1-3 of 3 results.