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

A068911 Number of n-step walks (each step +-1 starting from 0) which are never more than 2 or less than -2.

Original entry on oeis.org

1, 2, 4, 6, 12, 18, 36, 54, 108, 162, 324, 486, 972, 1458, 2916, 4374, 8748, 13122, 26244, 39366, 78732, 118098, 236196, 354294, 708588, 1062882, 2125764, 3188646, 6377292, 9565938, 19131876, 28697814, 57395628, 86093442, 172186884, 258280326, 516560652
Offset: 0

Views

Author

Henry Bottomley, Mar 06 2002

Keywords

Comments

From Johannes W. Meijer, May 29 2010: (Start)
a(n) is the number of ways White can force checkmate in exactly (n+1) moves, n >= 0, ignoring the fifty-move and the triple repetition rules, in the following chess position: White Ka1, Ra8, Bc1, Nb8, pawns a6, a7, b2, c6, d2, f6, g5 and h6; Black Ke8, Nh8, pawns b3, c7, d3, f7, g6 and h7. (After Noam D. Elkies, see link; diagram 5).
Counts all paths of length n, n >= 0, starting at the third node on the path graph P_5, see the Maple program. (End)
From Alec Jones, Feb 25 2016: (Start)
The a(n) are the n-th terms in a "Fibonacci snake" drawn on a rectilinear grid. The n-th term is computed as the sum of the previous terms in cells adjacent to the n-th cell (diagonals included). (This sequence excludes the first term of the snake.)
For example:
1 ... 1 1 ... 1 4 1 4 6 ... 1 4 6 1 4 6 ... and so on.
1 ... 1 2 1 2 ... 1 2 1 2 12 ... 1 2 12 18 (End)
From Gus Wiseman, Oct 06 2023: (Start)
Also the number of subsets of {1..n} containing no two distinct elements summing to n. The a(0) = 1 through a(4) = 12 subsets are:
{} {} {} {} {}
{1} {1} {1} {1}
{2} {2} {2}
{1,2} {3} {3}
{1,3} {4}
{2,3} {1,2}
{1,4}
{2,3}
{2,4}
{3,4}
{1,2,4}
{2,3,4}
For n+1 instead of n we have A038754, complement A167762.
Including twins gives A117855, complement A366131.
The complement is counted by A365544.
For all subsets (not just pairs) we have A365377, complement A365376. (End)

Examples

			The a(3) = 6 walks: (0,-1,-2,-1), (0,-1,0,-1), (0,-1,0,1), (0,1,0,-1), (0,1,0,1), (0,1,2,1). - _Gus Wiseman_, Oct 10 2023
		

Crossrefs

Cf. A000007, A016116 (without initial term), A068912, A068913 for similar.
Equals A060647(n-1)+1.
First differences are A117855.

Programs

  • Magma
    [Floor((5-(-1)^n)*3^Floor(n/2)/3): n in [0..40]]; // Bruno Berselli, Feb 26 2016, after Charles R Greathouse IV
    
  • Maple
    with(GraphTheory): G:= PathGraph(5): A:=AdjacencyMatrix(G): nmax:=34; for n from 0 to nmax do B(n):=A^n; a(n):=add(B(n)[3,k], k=1..5) od: seq(a(n), n=0..nmax); # Johannes W. Meijer, May 29 2010
    # second Maple program:
    a:= proc(n) a(n):= `if`(n<2, n+1, (4-irem(n, 2))/2*a(n-1)) end:
    seq(a(n), n=0..40);  # Alois P. Heinz, Feb 03 2019
  • Mathematica
    Join[{1},Transpose[NestList[{Last[#],3First[#]}&,{2,4},40]][[1]]] (* Harvey P. Dale, Oct 24 2011 *)
    Table[Length[Select[Subsets[Range[n]],FreeQ[Total/@Subsets[#,{2}],n]&]],{n,0,15}] (* Gus Wiseman, Oct 06 2023 *)
  • PARI
    a(n)=[4,6][n%2+1]*3^(n\2)\3 \\ Charles R Greathouse IV, Feb 26 2016
    
  • Python
    def A068911(n): return 3**(n>>1)<<1 if n&1 else (3**(n-1>>1)<<2 if n else 1) # Chai Wah Wu, Aug 30 2024

Formula

a(n) = A068913(2, n) = 2*A038754(n-1) = 3*a(n-2) = a(n-1)*a(n-2)/a(n-3) starting with a(0)=1, a(1)=2, a(2)=4 and a(3)=6.
For n>0: a(2n) = 4*3^(n-1) = 2*a(2n-1); a(2n+1) = 2*3^n = 3*a(2n)/2 = 2*a(2n)-A000079(n-2).
From Paul Barry, Feb 17 2004: (Start)
G.f.: (1+x)^2/(1-3x^2).
a(n) = 2*3^((n+1)/2)*((1-(-1)^n)/6 + sqrt(3)*(1+(-1)^n)/9) - (1/3)*0^n.
The sequence 0, 1, 2, 4, ... has a(n) = 2*3^(n/2)*((1+(-1)^n)/6 + sqrt(3)*(1-(-1)^n)/9) - (2/3)*0^n + (1/3)*Sum_{k=0..n} binomial(n, k)*k*(-1)^k. (End)
a(n) = 2^((3 + (-1)^n)/2)*3^((2*n - 3 - (-1)^n)/4) - ((1 - (-1)^(2^n)))/6. - Luce ETIENNE, Aug 30 2014
For n > 2, indexing from 0, a(n) = a(n-1) + a(n-2) if n is odd, a(n-1) + a(n-2) + a(n-3) if n is even. - Alec Jones, Feb 25 2016
a(n) = 2*a(n-1) if n is even, a(n-1) + a(n-2) if n is odd. - Vincenzo Librandi, Feb 26 2016
E.g.f.: (4*cosh(sqrt(3)*x) + 2*sqrt(3)*sinh(sqrt(3)*x) - 1)/3. - Stefano Spezia, Feb 17 2022

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

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 0, 3, 3, 0, 0, 3, 6, 3, 0, 0, 0, 9, 9, 0, 0, 0, 0, 9, 18, 9, 0, 0, 0, 0, 0, 27, 27, 0, 0, 0, 0, 0, 0, 27, 54, 27, 0, 0, 0, 0, 0, 0, 0, 81, 81, 0, 0, 0, 0, 0, 0, 0, 0, 81, 162, 81, 0, 0, 0, 0
Offset: 0

Views

Author

Philippe Deléham, Mar 13 2013

Keywords

Examples

			Square array begins:
1, 1, 1,  0,  0,   0,   0,   0, 0, ... n = 0
1, 2, 3,  3,  0,   0,   0,   0, 0, ... n = 1
1, 3, 6,  9,  9,   0,   0,   0, 0, ... n = 2
0, 3, 9, 18, 27,  27,   0,   0, 0, ... n = 3
0, 0, 9, 27, 54,  81,  81,   0, 0, ... n = 4
0, 0, 0, 27, 81, 162, 243, 243, 0, ... n = 5
....
		

Crossrefs

Formula

T(n,n) = A025192(n).
T(n+1,n) = T(n+2,n) = T(n,n+1) = T(n,n+2) = 3^n = A000244(n).
Sum_{k, 0<=k<=n} T(n-k,k) = A068911(n).

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

Original entry on oeis.org

1, 1, 1, 0, 2, 0, 0, 2, 2, 0, 0, 0, 4, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Philippe Deléham, Mar 13 2013

Keywords

Comments

With zeros omitted, this is A173862.

Examples

			Square array begins:
1, 1, 0, 0,  0,  0,  0, 0, ... row n=0
1, 2, 2, 0,  0,  0,  0, 0, ... row n=1
0, 2, 4, 4,  0,  0,  0, 0, ... row n=2
0, 0, 4, 8,  8,  0,  0, 0, ... row n=3
0, 0, 0, 8, 16, 16,  0, 0, ... row n=4
0, 0, 0, 0, 16, 32, 32, 0, ... row n=5
...
		

Crossrefs

Formula

T(n,n) = T(n+1,n) = T(n,n+1) = 2^n = A000079(n).
Sum_{k, 0<=k<=n} T(n-k,k) = A016116(n+1) = A163403(n+1).

A216219 Square array T, read by antidiagonals: T(n,k) = 0 if n-k>=5 or if k-n>=5, T(4,0) = T(3,0) = 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, 1, 1, 4, 6, 4, 1, 0, 5, 10, 10, 5, 0, 0, 5, 15, 20, 15, 5, 0, 0, 0, 20, 35, 35, 20, 0, 0, 0, 0, 20, 55, 70, 55, 20, 0, 0, 0, 0, 0, 75, 125, 125, 75, 0, 0, 0, 0, 0, 0, 75, 200, 250, 200
Offset: 0

Views

Author

Philippe Deléham, Mar 13 2013

Keywords

Examples

			Square array begins:
1, 1,  1,  1,   1,   0,   0,   0,    0,    0, 0, ...
1, 2,  3,  4,   5,   5,   0,   0,    0,    0, 0, ...
1, 3,  6, 10,  15,  20,  20,   0,    0,    0, 0, ...
1, 4, 10, 20,  35,  55,  75,  75,    0,    0, 0, ...
1, 5, 15, 35,  70, 125, 200, 275,  275,    0, 0, ...
0, 5, 20, 55, 125, 250, 450, 725, 1000, 1000, 0, ...
0, 0, 20, 75, 200, 450, 900, ...
		

Crossrefs

Formula

T(n,n) = A147748(n).
T(n+1,n) = T(n,n+1) = A081567(n).
T(n+2,n) = T(n,n+2) = A039717(n+1).
T(n+3,n) = T(n+4,n) = T(n,n+3) = T(n,n+4) = A030191(n).
Sum_{k, 0<=k<=n} T(n-k,k) = A068913(4,n) = A216212(n).

A068914 Square array read by antidiagonals of number of k step walks (each step +-1 starting from 0) which are never more than n or less than 0.

Original entry on oeis.org

1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 2, 1, 1, 0, 1, 2, 2, 1, 1, 0, 1, 4, 3, 2, 1, 1, 0, 1, 4, 5, 3, 2, 1, 1, 0, 1, 8, 8, 6, 3, 2, 1, 1, 0, 1, 8, 13, 9, 6, 3, 2, 1, 1, 0, 1, 16, 21, 18, 10, 6, 3, 2, 1, 1, 0, 1, 16, 34, 27, 19, 10, 6, 3, 2, 1, 1, 0, 1, 32, 55, 54, 33, 20, 10, 6, 3, 2, 1, 1, 0, 1, 32, 89
Offset: 0

Views

Author

Henry Bottomley, Mar 06 2002

Keywords

Comments

The (n,k)-entry of the square array is p(n,k) in the R. Kemp reference (see Table 1 on p. 160 and Theorem 2 on p. 159). - Emeric Deutsch, Jun 16 2011

Examples

			Rows start:
1,0,0,0,0,...;
1,1,1,1,1,...;
1,1,2,2,4,...;
1,1,2,3,5,...;
etc.
		

Crossrefs

Rows include effectively A000007, A000012, A016116, A000045, A038754, A028495, A030436, A061551. Central and lower diagonals are A001405. Cf. A068913 for starting in the middle rather than an edge.
Reflected version of A094718.

Programs

  • Maple
    v := ((1-sqrt(1-4*z^2))*1/2)/z: G := proc (k) options operator, arrow: (1+v^2)*(1-v^(k+1))/((1-v)*(1+v^(k+2))) end proc: a := proc (n, k) options operator, arrow: coeff(series(G(k), z = 0, 80), z, n) end proc: for n from 0 to 15 do seq(a(n, k), k = 0 .. 15) end do; # yields the first 16 entries of the first 16 rows of the square array
    v := ((1-sqrt(1-4*z^2))*1/2)/z: G := proc (k) options operator, arrow: (1+v^2)*(1-v^(k+1))/((1-v)*(1+v^(k+2))) end proc: a := proc (n, k) options operator, arrow: coeff(series(G(k), z = 0, 80), z, n) end proc: for n from 0 to 13 do seq(a(n-i, i), i = 0 .. n) end do; # yields the first 14 antidiagonals of the square array in triangular form
  • Mathematica
    v = (1-Sqrt[1-4z^2])/(2z); f[k_] = (1+v^2)*(1-v^(k+1))/((1-v)*(1+v^(k+2))) ; m = 14; a = Table[ PadRight[ CoefficientList[ Series[f[k], {z, 0, m}], z], m], {k, 0, m}]; Flatten[Table[a[[n+1-k, k]], {n, m}, {k, n, 1, -1}]][[;; 95]] (* Jean-François Alcover, Jul 13 2011, after Emeric Deutsch *)
  • PARI
    T(n,k) = sum(j=floor(-n/(k+2)), ceil(n/(k+2)), (-1)^j*binomial(n,floor((n+(k+2)*j)/2))); \\ Stefano Spezia, May 08 2020

Formula

An explicit expression for the (n,k)-entry of the square array can be found in the R. Kemp reference (Theorem 2 on p. 159). - Emeric Deutsch, Jun 16 2011
The g.f. of column k is (1 + v^2)*(1 - v^(k+1))/((1 - v)*(1 + v^(k+2))), where v = (1 - sqrt(1-4*z^2))/(2*z) (see p. 159 of the R. Kemp reference). - Emeric Deutsch, Jun 16 2011

A068912 Number of n step walks (each step +/-1 starting from 0) which are never more than 3 or less than -3.

Original entry on oeis.org

1, 2, 4, 8, 14, 28, 48, 96, 164, 328, 560, 1120, 1912, 3824, 6528, 13056, 22288, 44576, 76096, 152192, 259808, 519616, 887040, 1774080, 3028544, 6057088, 10340096, 20680192, 35303296, 70606592, 120532992, 241065984, 411525376, 823050752, 1405035520, 2810071040
Offset: 0

Views

Author

Henry Bottomley, Mar 06 2002

Keywords

Comments

The number of n step walks (each step +/-1 starting from 0) which are never more than k or less than -k is given by a(n,k) = 2^n/(k+1)*Sum_{r=1..k+1} (-1)^r*cos((Pi*(2*r-1))/(2*(k+1)))^n*cot((Pi*(1-2*r))/(4*(k+1))). Here we have k=3. - Herbert Kociemba, Sep 19 2020

Crossrefs

Cf. A000007, A016116 (without initial term), A068911, A068913 for similar.

Programs

  • Maple
    # From Peter Luschny, Sep 20 2020: (Start)
    r := 1 + 2^(1/2): s := 1 - 2^(1/2):
    c := n -> (1+r)^(n/2)*(r+(2*(1+r))^(1/2)+(-1)^n*(r-(2*(1+r))^(1/2))):
    b := n -> (1+s)^(n/2)*(s-(2*(1+s))^(1/2)+(-1)^n*(s+(2*(1+s))^(1/2))):
    a := n -> (c(n) + b(n))/4:
    # Alternatively:
    a := proc(n) local h; h := n -> add((1+x)*(2+x)^(n/2), x=[sqrt(2),-sqrt(2)]);
    if n::even then h(n)/2 else h(n-1) fi end:
    seq(simplify(a(n)), n=0..30); # (End)
  • Mathematica
    nn=33; CoefficientList[Series[s+a + b + c + d + e +f/.Solve[{s ==1 + x a + x b, a==x s + x c, b==x s +x d, c==x a +x e, d== x b + x f, e==x c, f==x d,z==x e + x f },{s,a,b,c,d,e,f,z}],{x,0,nn}],x] (* Geoffrey Critzer, Jan 13 2014 *)
    a[n_,k_]:=2^n /(k+1) Sum[(-1)^r Cos[(Pi (2r-1))/(2 (k+1))]^n Cot[(Pi (1-2r))/(4 (k+1))] ,{r,1,k+1}]
    Table[a[n,3],{n,0,40}]//Round (* Herbert Kociemba, Sep 19 2020 *)
    a[n_]:=Module[{r=2+Sqrt[2]},Floor[(r^(n/2) (-2 (-1+(-1)^n) Sqrt[r]+(1+(-1)^n) r))/(4 Sqrt[2])]]
    Table[a[n],{n,0,40}] (* Herbert Kociemba, Sep 21 2020 *)

Formula

G.f.: (1+2*x)/(1-4*x^2+2*x^4).
a(n) = A068913(3, n).
a(n) = 4*a(n-2) - 2*a(n-4).
a(2*n) = A007070(n) = 2*a(2*n-1)-A060995(n); a(2*n+1) = 2*a(2*n).
a(n) = (2^n/4)*Sum_{r=1..4} (-1)^r*cos((Pi*(2*r-1))/8)^n*cot((Pi*(1-2*r))/16). - Herbert Kociemba, Sep 19 2020
Conjecture: a(n) = floor((1+r)^(n/2)*(r+(2*(1+r))^(1/2)+(-1)^n*(r-(2*(1+r))^(1/2)))/4) where r = 1 + 2^(1/2). - Peter Luschny, Sep 20 2020
From Herbert Kociemba, Sep 20 2020: (Start)
With the standard procedure to obtain an explicit formula for a(n) for a linear recurrence and r1=2-sqrt(2) and r2=2+sqrt(2) we get
a(n) = a1(n) + a2(n) with
a1(n) = -(r1^(n/2)*(-2*(-1+(-1)^n)*sqrt(r1)+(1+(-1)^n)*r1))/(4*sqrt(2)) and
a2(n) = +(r2^(n/2)*(-2*(-1+(-1)^n)*sqrt(r2)+(1+(-1)^n)*r2))/(4*sqrt(2)).
We have -1

A216212 Number of n step walks (each step +-1 starting from 0) which are never more than 4 or less than -4.

Original entry on oeis.org

1, 2, 4, 8, 16, 30, 60, 110, 220, 400, 800, 1450, 2900, 5250, 10500, 19000, 38000, 68750, 137500, 248750, 497500, 900000, 1800000, 3256250, 6512500, 11781250, 23562500, 42625000, 85250000, 154218750, 308437500, 557968750, 1115937500, 2018750000, 4037500000
Offset: 0

Author

Philippe Deléham, Mar 13 2013

Keywords

Comments

The number of n step walks (each step +-1 starting from 0) which are never more than k or less than -k is given by a(n,k) = 2^n/(k+1)*Sum_{r=1..k+1} (-1)^r*cos((Pi*(2*r-1))/(2*(k+1)))^n*cot((Pi*(1-2*r))/(4*(k+1))), n<>0 if k even. Here we have k=4. - Herbert Kociemba, Sep 22 2020

Crossrefs

Cf. A068911, A068912, A068913, A178381 (starting from 4).

Programs

  • Mathematica
    nn=30;CoefficientList[Series[(1+x-x^2)^2/(1-5x^2+5x^4),{x,0,nn}],x] (* Geoffrey Critzer, Jan 14 2014 *)
    a[0,4]=1; a[n_,k_]:=2^n/(k+1) Sum[(-1)^r Cos[(Pi (2r-1))/(2 (k+1))]^n Cot[(Pi (1-2r))/(4 (k+1))],{r,1,k+1}]
    Table[a[n,4],{n,0,40}]//Round (* Herbert Kociemba, Sep 22 2020 *)

Formula

a(n) = A068913(4,n).
G.f.: (1+2*x-x^2-2*x^3+x^4)/(1-5*x^2+5*x^4).
a(n) = 5*a(n-2) - 5*a(n-4), a(0) = 1, a(1) = 2, a(2) = 4, a(3) = 8, a(4) = 16.
a(2*n+1) = 2*A039717(n+1), a(2*n+2) = 4*A039717(n+1).
a(n) = (2^n/5)*Sum_{r=1..5} (-1)^r*cos(Pi*(2*r-1)/10)^n*cot(Pi*(1-2*r)/20), n>0. - Herbert Kociemba, Sep 22 2020

A216241 Number of n-step walks (each step +-1 starting from 0) which are never more than 5 or less than -5.

Original entry on oeis.org

1, 2, 4, 8, 16, 32, 62, 124, 236, 472, 890, 1780, 3340, 6680, 12502, 25004, 46732, 93464, 174554, 349108, 651740, 1303480, 2432918, 4865836, 9080956, 18161912, 33892954, 67785908, 126494956, 252989912, 472095062, 944190124, 1761901676, 3523803352, 6575544410, 13151088820
Offset: 0

Author

Philippe Deléham, Mar 15 2013

Keywords

Crossrefs

Cf. Rows of A068913: A000007, A016116 (without initial term), A068911, A068912, A214846, A216212.

Programs

  • Mathematica
    nn=35;CoefficientList[Series[(1+2x)(1-x^2)^2/(1-6x^2+9x^4-2x^6),{x,0,nn}],x] (* Geoffrey Critzer, Jan 14 2014 *)

Formula

a(n) = A068913(5,n).
a(n) = 6*a(n-2) - 9*a(n-4) + 2*a(n-6).
a(n) = 2^n for n < 6.
G.f.: ((1-x)^2*(1+x)^2*(1+2*x)) / ((1-2*x^2)*(1-4*x^2+x^4)).
a(2*n+1) = 2*a(2*n).
a(n) = Sum_{k=0..n} A214846(n-k, k). - Philippe Deléham, Mar 25 2013

Extensions

a(34) corrected by Sean A. Irvine, May 19 2019

A235701 Number of n step walks (each step +/- 1 starting from 0) which are never more than 6 or less than -6.

Original entry on oeis.org

1, 2, 4, 8, 16, 32, 64, 126, 252, 490, 980, 1890, 3780, 7252, 14504, 27734, 55468, 105840, 211680, 403368, 806736, 1535954, 3071908, 5845406, 11690812, 22238062, 44476124, 84582428, 169164856, 321661970, 643323940, 1223146232, 2446292464, 4650833040
Offset: 0

Author

Geoffrey Critzer, Jan 14 2014

Keywords

Crossrefs

Row n=6 of A068913.

Programs

  • Mathematica
    nn=30;r=Solve[{s==1 + x a + x b, a==x s + x c, b==x s +x d, c==x a +x e, d==x b + x f, e==x c+x g, f==x d+x h,g==x e+x i, h==x f+x j,i==x g+x k,j==x h+x l,k==x i,l==x j, z==x k + x l }, {s,a,b,c,d,e,f,g,h,i,j,k,l,z}]; CoefficientList[Series[s+a+b+c+d+e+f+g+h+i+j+k+l/.r,{x,0,nn}],x]

Formula

G.f.: (1 + x - 2*x^2 - x^3)^2/(1 - 7*x^2 + 14*x^4 - 7*x^6).
Showing 1-9 of 9 results.