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

A006012 a(0) = 1, a(1) = 2, a(n) = 4*a(n-1) - 2*a(n-2), n >= 2.

Original entry on oeis.org

1, 2, 6, 20, 68, 232, 792, 2704, 9232, 31520, 107616, 367424, 1254464, 4283008, 14623104, 49926400, 170459392, 581984768, 1987020288, 6784111616, 23162405888, 79081400320, 270000789504, 921840357376, 3147359850496
Offset: 0

Views

Author

Keywords

Comments

Number of (s(0), s(1), ..., s(2n)) such that 0 < s(i) < 8 and |s(i) - s(i-1)| = 1 for i = 1,2,...,2n, s(0) = 4, s(2n) = 4. - Herbert Kociemba, Jun 12 2004
a(n-1) counts permutations pi on [n] for which the pairs {i, pi(i)} with i < pi(i), considered as closed intervals [i+1,pi(i)], do not overlap; equivalently, for each i in [n] there is at most one j <= i with pi(j) > i. Counting these permutations by the position of n yields the recurrence relation. - David Callan, Sep 02 2003
a(n) is the sum of (n+1)-th row terms of triangle A140070. - Gary W. Adamson, May 04 2008
The binomial transform is in A083878, the Catalan transform in A084868. - R. J. Mathar, Nov 23 2008
Equals row sums of triangle A152252. - Gary W. Adamson, Nov 30 2008
Counts all paths of length (2*n), n >= 0, starting at the initial node on the path graph P_7, see the second Maple program. - Johannes W. Meijer, May 29 2010
From L. Edson Jeffery, Apr 04 2011: (Start)
Let U_1 and U_3 be the unit-primitive matrices (see [Jeffery])
U_1 = U_(8,1) = [(0,1,0,0); (1,0,1,0); (0,1,0,1); (0,0,2,0)] and
U_3 = U_(8,3) = [(0,0,0,1); (0,0,2,0); (0,2,0,1); (2,0,2,0)]. Then a(n) = (1/4) * Trace(U_1^(2*n)) = (1/2^(n+2)) * Trace(U_3^(2*n)). (See also A084130, A001333.) (End)
Pisano period lengths: 1, 1, 8, 1, 24, 8, 6, 1, 24, 24, 120, 8, 168, 6, 24, 1, 8, 24, 360, 24, ... - R. J. Mathar, Aug 10 2012
a(n) is the first superdiagonal of array A228405. - Richard R. Forberg, Sep 02 2013
Conjecture: With offset 1, a(n) is the number of permutations on [n] with no subsequence abcd such that (i) bc are adjacent in position and (ii) max(a,c) < min(b,d). For example, the 4 permutations of [4] not counted by a(4) are 1324, 1423, 2314, 2413. - David Callan, Aug 27 2014
The conjecture of David Callan above is correct - with offset 1, a(n) is the number of permutations on [n] with no subsequence abcd such that (i) bc are adjacent in position and (ii) max(a,c) < min(b,d). - Yonah Biers-Ariel, Jun 27 2017
From Gary W. Adamson, Jul 22 2016: (Start)
A production matrix for the sequence is M =
1, 1, 0, 0, 0, 0, ...
1, 0, 3, 0, 0, 0, ...
1, 0, 0, 3, 0, 0, ...
1, 0, 0, 0, 3, 0, ...
1, 0, 0, 0, 0, 3, ...
...
Take powers of M, extracting the upper left terms; getting the sequence starting: (1, 1, 2, 6, 20, 68, ...). (End)
From Gary W. Adamson, Jul 24 2016: (Start)
The sequence is the INVERT transform of the powers of 3 prefaced with a "1": (1, 1, 3, 9, 27, ...) and is N=3 in an infinite of analogous sequences starting:
N=1 (A000079): 1, 2, 4, 8, 16, 32, ...
N=2 (A001519): 1, 2, 5, 13, 34, 89, ...
N=3 (A006012): 1, 2, 6, 20, 68, 232, ...
N=4 (A052961): 1, 2, 7, 29, 124, 533, ...
N=5 (A154626): 1, 2, 8, 40, 208, 1088, ...
N=6: 1, 2, 9, 53, 326, 2017, ...
... (End)
Number of permutations of length n > 0 avoiding the partially ordered pattern (POP) {1>2, 1>3, 4>2, 4>3} of length 4. That is, number of length n permutations having no subsequences of length 4 in which the first and fourth elements are larger than the second and third elements. - Sergey Kitaev, Dec 08 2020
a(n-1) is the number of permutations of [n] that can be obtained by placing n points on an X-shape (two crossing lines with slopes 1 and -1), labeling them 1,2,...,n by increasing y-coordinate, and then reading the labels by increasing x-coordinate. - Sergi Elizalde, Sep 27 2021
Consider a stack of pancakes of height n, where the only allowed operation is reversing the top portion of the stack. First, perform a series of reversals of decreasing sizes, followed by a series of reversals of increasing sizes. The number of distinct permutations of the initial stack that can be reached through these operations is a(n). - Thomas Baruchel, May 12 2025
Number of permutations of [n] that are correctly sorted after performing one left-to-right pass and one right-to-left pass of the cocktail sort. - Thomas Baruchel, May 16 2025

References

  • D. H. Greene and D. E. Knuth, Mathematics for the Analysis of Algorithms. Birkhäuser, Boston, 3rd edition, 1990, p. 86.
  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 3, Sect 5.4.8 Answer to Exer. 8.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a006012 n = a006012_list !! n
    a006012_list = 1 : 2 : zipWith (-) (tail $ map (* 4) a006012_list)
    (map (* 2) a006012_list)
    -- Reinhard Zumkeller, Oct 03 2011
    
  • Magma
    [n le 2 select n else 4*Self(n-1)- 2*Self(n-2): n in [1..30]]; // Vincenzo Librandi, Apr 05 2011
    
  • Maple
    A006012:=-(-1+2*z)/(1-4*z+2*z**2); # Simon Plouffe in his 1992 dissertation
    with(GraphTheory): G:=PathGraph(7): A:= AdjacencyMatrix(G): nmax:=24; n2:=2*nmax: for n from 0 to n2 do B(n):=A^n; a(n):=add(B(n)[1,k],k=1..7); od: seq(a(2*n),n=0..nmax); # Johannes W. Meijer, May 29 2010
  • Mathematica
    LinearRecurrence[{4,-2},{1,2},50] (* or *) With[{c=Sqrt[2]}, Simplify[ Table[((2+c)^n+(3+2c)(2-c)^n)/(2(2+c)),{n,50}]]] (* Harvey P. Dale, Aug 29 2011 *)
  • PARI
    {a(n) = real(((2 + quadgen(8))^n))}; /* Michael Somos, Feb 12 2004 */
    
  • PARI
    {a(n) = if( n<0, 2^n, 1) * polsym(x^2 - 4*x + 2, abs(n))[abs(n)+1] / 2}; /* Michael Somos, Feb 12 2004 */
    
  • PARI
    Vec((1-2*x)/(1-4*x+2*x^2) + O(x^100)) \\ Altug Alkan, Dec 05 2015
    
  • Python
    l = [1, 2]
    for n in range(2, 101): l.append(4 * l[n - 1] - 2 * l[n - 2])
    print(l)  # Indranil Ghosh, Jul 02 2017
    
  • SageMath
    A006012=BinaryRecurrenceSequence(4,-2,1,2)
    print([A006012(n) for n in range(41)]) # G. C. Greubel, Aug 27 2025

Formula

G.f.: (1-2*x)/(1 - 4*x + 2*x^2).
a(n) = 2*A007052(n-1) = A056236(n)/2.
Limit_{n -> oo} a(n)/a(n-1) = 2 + sqrt(2). - Zak Seidov, Oct 12 2002
From Paul Barry, May 08 2003: (Start)
Binomial transform of A001333.
E.g.f.: exp(2*x)*cosh(sqrt(2)*x). (End)
a(n) = Sum_{k=0..floor(n/2)} binomial(n, 2k)*2^(n-k) = Sum_{k=0..n} binomial(n, k)*2^(n-k/2)(1+(-1)^k)/2. - Paul Barry, Nov 22 2003 (typo corrected by Manfred Scheucher, Jan 17 2023)
a(n) = ((2+sqrt(2))^n + (2-sqrt(2))^n)/2.
a(n) = Sum_{k=0..n} 2^k*A098158(n,k). - Philippe Deléham, Dec 04 2006
a(n) = A007070(n) - 2*A007070(n-1). - R. J. Mathar, Nov 16 2007
a(n) = Sum_{k=0..n} A147703(n,k). - Philippe Deléham, Nov 29 2008
a(n) = Sum_{k=0..n} A201730(n,k). - Philippe Deléham, Dec 05 2011
G.f.: G(0) where G(k)= 1 + 2*x/((1-2*x) - 2*x*(1-2*x)/(2*x + (1-2*x)*2/G(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Dec 10 2012
G.f.: G(0)*(1-2*x)/2, where G(k) = 1 + 1/(1 - 2*x*(4*k+2-x)/( 2*x*(4*k+4-x) + 1/G(k+1) )); (continued fraction). - Sergei N. Gladkovskii, Jan 27 2014
a(-n) = a(n) / 2^n for all n in Z. - Michael Somos, Aug 24 2014
a(n) = A265185(n) / 4, connecting this sequence to the simple Lie algebra B_4. - Tom Copeland, Dec 04 2015
From G. C. Greubel, Aug 27 2025: (Start)
a(n) = 2^((n-2)/2)*( (n+1 mod 2)*A002203(n) + 2*sqrt(2)*(n mod 2)*A000129(n) ).
a(n) = 2^(n/2)*ChebyshevT(n, sqrt(2)). (End)

A030436 Expansion of g.f. (1 + x - 2*x^2 - x^3)/(1 - 4*x^2 + 2*x^4).

Original entry on oeis.org

1, 1, 2, 3, 6, 10, 20, 34, 68, 116, 232, 396, 792, 1352, 2704, 4616, 9232, 15760, 31520, 53808, 107616, 183712, 367424, 627232, 1254464, 2141504, 4283008, 7311552, 14623104, 24963200, 49926400, 85229696, 170459392, 290992384, 581984768, 993510144, 1987020288, 3392055808
Offset: 0

Views

Author

N. J. A. Sloane, Dec 11 1999

Keywords

Comments

Also (starting 3, 6, ...) the number of zig-zag paths from top to bottom of a rectangle of width 7 whose color is not that of the top right corner.
From Johannes W. Meijer, May 29 2010: (Start)
The a(n) represent the number of possible chess games, ignoring the fifty-move and the triple repetition rules, after n moves by White in the following position: White Ka1, Nh1, pawns a2, b6, c2, d6, f2, g3 and h2; Black Ka8, Bc8, pawns a3, b7, c3, d7, f3, g4 and h3.
Counts all paths of length n, n>=0, starting at the initial node on the path graph P_7, see the Maple program. (End)
Range of row n of the circular Pascal array of order 8. - Shaun V. Ault, Jun 05 2014.
In general, a(n,m) = (2^n/(m+1))*Sum_{r=1..m} (1-(-1)^r)*cos(Pi*r/(m+1))^n*(1+cos(Pi*r/(m+1))) gives the number of paths of length n starting at the initial node on the path graph P_m. Here we have m=7. - Herbert Kociemba, Sep 17 2020

Examples

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

Crossrefs

Programs

  • Maple
    with(GraphTheory): P:=7: G:=PathGraph(P): A:= AdjacencyMatrix(G): nmax:=31; for n from 0 to nmax do B(n):=A^n; a(n):=add(B(n)[1,k],k=1..P); od: seq(a(n),n=0..nmax); # Johannes W. Meijer, May 29 2010
    X := j -> (-1)^(j/8) - (-1)^(1-j/8):
    a := k -> add((2 + X(j))*X(j)^k, j in [1, 3, 5, 7])/8:
    seq(simplify(a(n)), n=0..30); # Peter Luschny, Sep 17 2020
  • Mathematica
    CoefficientList[Series[(1+x-2x^2-x^3)/(1-4x^2+2x^4),{x,0,40}],x] (* or *) LinearRecurrence[{0,4,0,-2},{1,1,2,3},41] (* Harvey P. Dale, May 11 2011 *)
    a[n_,m_]:=2^(n+1)/(m+1) Module[{x=(Pi r)/(m+1)},Sum[Cos[x]^n (1+Cos[x]),{r,1,m,2}]]
    Table[a[n,7],{n,0,40}]//Round (* Herbert Kociemba, Sep 17 2020 *)
  • PARI
    Vec((1+x-2*x^2-x^3)/(1-4*x^2+2*x^4)+O(x^99)) \\ Charles R Greathouse IV, Sep 23 2012
    
  • PARI
    {a(n) = if( n<0, 0, polsym( x^4 - 4*x^2 + 2, n + n%2)[n + n%2 + 1] / (4 * (n%2 + 1)))}; /* Michael Somos, Feb 08 2015 */

Formula

a(0)=a(1)=1, a(2)=2, a(3)=3, a(n)=4*a(n-2)-2*a(n-4). - Harvey P. Dale, May 11 2011
a(n) = (2+sqrt(2+sqrt(2)))/8*(sqrt(2+sqrt(2)))^n + (2-sqrt(2+sqrt(2)))/8*(-sqrt(2+sqrt(2)))^n + (2+sqrt(2-sqrt(2)))/8*(sqrt(2-sqrt(2)))^n + (2-sqrt(2-sqrt(2)))/8*(-sqrt(2-sqrt(2)))^n. - Sergei N. Gladkovskii, Aug 23 2012
a(n) = A030435(n)/2. a(2*n) = A006012(n). a(2*n + 1) = A007052(n). - Michael Somos, Mar 06 2003
a(n) = (2^n/8)*Sum_{r=1..7} (1-(-1)^r)cos(Pi*r/8)^n*(1+cos(Pi*r/8)). - Herbert Kociemba, Sep 17 2020
E.g.f.: (2*cosh(r*x) + 2*cosh(s*x) + r*sinh(r*x) + s*sinh(s*x))/4, where r = sqrt(2 - sqrt(2)) and s = sqrt(2 + sqrt(2)). - Stefano Spezia, Jun 14 2023

Extensions

Comment and link added and typo in cross-reference corrected by Joseph Myers, Dec 24 2008, May 30 2010

A024175 Expansion of g.f. (x^3 - 6*x^2 + 5*x - 1)/((2*x - 1)*(2*x^2 - 4*x + 1)).

Original entry on oeis.org

1, 1, 2, 5, 14, 42, 132, 428, 1416, 4744, 16016, 54320, 184736, 629280, 2145600, 7319744, 24979584, 85262464, 291057920, 993641216, 3392317952, 11581727232, 39541748736, 135002491904, 460924372992, 1573688313856, 5372896120832, 18344191078400, 62630938517504
Offset: 0

Views

Author

Keywords

Comments

Number of (s(0), s(1), ..., s(2*n)) such that 0 < s(i) < 8 and |s(i) - s(i-1)| = 1 for i = 1, 2, ..., 2*n, s(0) = 1, s(2*n) = 1. - Herbert Kociemba, Jun 11 2004
Counts all paths of length (2*n), n >= 0, starting and ending at the initial node on the path graph P_7, see the Maple program. - Johannes W. Meijer, May 29 2010

Examples

			1 + x + 2*x^2 + 5*x^3 + 14*x^4 + 42*x^5 + 132*x^6 + 428*x^7 + ...
		

Crossrefs

Programs

  • Maple
    with(GraphTheory): G:=PathGraph(7): A:= AdjacencyMatrix(G): nmax:=26; n2:=2*nmax: for n from 0 to n2 do B(n):=A^n; a(n):=B(n)[1,1]; od: seq(a(2*n),n=0..nmax); # Johannes W. Meijer, May 29 2010
  • Mathematica
    CoefficientList[Series[(x^3-6*x^2+5*x-1)/((2*x-1)*(2*x^2-4*x+1)),{x,0,30}],x] (* Vincenzo Librandi, May 10 2012 *)
  • PARI
    {a(n) = local(A); A = 1; for( i=1, 6, A = 1 / (1 - x*A)); polcoeff( A + x * O(x^n), n)} /* Michael Somos, May 12 2012 */

Formula

From Herbert Kociemba, Jun 11 2004: (Start)
a(n) = (1/4)*Sum_{r=1..7} sin(r*Pi/8)^2*(2*cos(r*Pi/8))^(2n), n >= 1.
a(n) = 6*a(n-1) - 10*a(n-2) + 4*a(n-3), n >= 4. (End)
a(n) = (1/4)*((2 + sqrt(2))^(n - 1) + (2 - sqrt(2))^(n - 1) + 2^n) for n >= 1. - Richard Choulet, Apr 19 2010
a(n) = 2^(n - 2) + A006012(n-1)/2, n > 0. - R. J. Mathar, Mar 14 2011
G.f.: 1 / (1 - x / (1 - x / (1 - x / (1 - x / (1 - x / (1 - x)))))). - Michael Somos, May 12 2012
E.g.f.: (1 + exp(2*x)*(1 + 2*cosh(sqrt(2)*x) - sqrt(2)*sinh(sqrt(2)*x)))/4. - Stefano Spezia, Jun 14 2023

A216232 Square array T, read by antidiagonals: T(n,k) = 0 if n-k >= 3 or if k-n >= 5, T(2,0) = T(1,0) = T(0,0) = T(0,1) = T(0,2) = T(0,3) = T(0,4) = 1, T(n,k) = T(n-1,k) + T(n,k-1).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 3, 0, 1, 4, 6, 3, 0, 0, 5, 10, 9, 0, 0, 0, 5, 15, 19, 9, 0, 0, 0, 0, 20, 34, 28, 0, 0, 0, 0, 0, 20, 54, 62, 28, 0, 0, 0, 0, 0, 0, 74, 116, 90, 0, 0, 0, 0, 0, 0, 0, 74, 190, 206, 90, 0, 0, 0, 0, 0, 0, 0, 0, 264, 396, 296, 0, 0, 0, 0, 0, 0, 0, 0, 0, 264, 660, 692, 296, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Philippe Deléham, Mar 14 2013

Keywords

Comments

Arithmetic hexagon of E. Lucas.

Examples

			Square array begins:
  1, 1, 1,  1,  1,   0,   0,   0,   0,   0, 0, ... row n=0
  1, 2, 3,  4,  5,   5,   0,   0,   0,   0, 0, ... row n=1
  1, 3, 6, 10, 15,  20,  20,   0,   0,   0, 0, ... row n=2
  0, 3, 9, 19, 34,  54,  74,  74,   0,   0, 0, ... row n=3
  0, 0, 9, 28, 62, 116, 190, 264, 264,   0, 0, ... row n=4
  0, 0, 0, 28, 90, 206, 396, 660, 924, 924, 0, ... row n=5
  ...
Array, read by rows, with 0 omitted:
   1,   1,   1,   1,    1
   1,   2,   3,   4,    5,    5
   1,   3,   6,  10,   15,   20,   20
        3,   9,  19,   34,   54,   74,   74
             9,  28,   62,  116,  190,  264,  264
                 28,   90,  206,  396,  660,  924,  924
                       90,  296,  692, 1352, 2276, 3200, 3200
  ...
		

References

  • E. Lucas, Théorie des nombres, Albert Blanchard, Paris, 1958, Tome 1, p. 89.

Crossrefs

Formula

T(n,n) = A094817(n), for n > 0.
T(n+1,n) = T(n+2,n) = A094803(n).
T(n,n+1) = A007052(n).
T(n,n+2) = A094821(n+1).
T(n,n+3) = T(n,n+4) = A094806(n).
Sum_{k=0..n} T(n-k,k) = A217730(n). - Philippe Deléham, Mar 22 2013

A217257 Square array T, read by antidiagonals: T(n,k) = 0 if n-k >= 1 or if k-n >= 7, T(0,0) = T(0,1) = T(0,2) = T(0,3) = T(0,3) = T(0,4) = T(0,5) = T(0,6) = 1, T(n,k) = T(n-1,k) + T(n,k-1).

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 1, 2, 0, 0, 1, 3, 2, 0, 0, 1, 4, 5, 0, 0, 0, 1, 5, 9, 5, 0, 0, 0, 0, 6, 14, 14, 0, 0, 0, 0, 0, 6, 20, 28, 14, 0, 0, 0, 0, 0, 0, 26, 48, 42, 0, 0, 0, 0, 0, 0, 0, 26, 74, 90, 42, 0, 0, 0, 0, 0, 0, 0, 0, 100, 164, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100, 264, 296, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 364, 560, 428, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Philippe Deléham, Mar 17 2013

Keywords

Comments

A hexagon arithmetic of E. Lucas.

Examples

			Square array begins:
1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... row n=0
0, 1, 2, 3, 4, 5, 6, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... row n=1
0, 0, 2, 5, 9, 14, 20, 26, 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... row n=2
0, 0, 0, 5, 14, 28, 48, 74, 100, 100, 0, 0, 0, 0, 0, 0, 0, ... row n=3
0, 0, 0, 0, 14, 42, 90, 162, 264, 364, 364, 0, 0, 0, 0, 0, ... row n=4
0, 0, 0, 0, 0, 42, 132, 296, 560, 924, 1288, 1288, 0, 0, 0, ... row n=5
...
		

References

  • E. Lucas, Théorie des nombres, A. Blanchard, Paris, 1958, p.89

Crossrefs

Cf. similar sequences: A216230, A216228, A216226, A216238, A216054.

Formula

T(n,n) = A024175(n).
T(n,n+1) = A024175(n+1).
T(n,n+2) = A094803(n+1).
T(n,n+3) = A007070(n).
T(n,n+4) = A094806(n+2).
T(n,n+5) = T(n,n+6) = A094811(n+2).
Sum_{k, 0<=k<=n} T(n-k,k) = A030436(n).

Extensions

a(69) = 0 deleted by Georg Fischer, Oct 16 2021
Showing 1-5 of 5 results.