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.

A318557 Number A(n,k) of n-member subsets of [k*n] whose elements sum to a multiple of k; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 2, 1, 0, 1, 1, 5, 10, 1, 0, 1, 1, 6, 30, 38, 1, 0, 1, 1, 9, 55, 165, 126, 1, 0, 1, 1, 10, 91, 460, 1001, 452, 1, 0, 1, 1, 13, 138, 969, 3876, 6198, 1716, 1, 0, 1, 1, 14, 190, 1782, 10630, 33594, 38760, 6470, 1, 0, 1, 1, 17, 253, 2925, 23751, 118755, 296010, 245157, 24310, 1, 0
Offset: 0

Views

Author

Alois P. Heinz, Aug 28 2018

Keywords

Comments

The sequence of row n satisfies a linear recurrence with constant coefficients of order A018804(n) for n>0.

Examples

			A(3,2) = 10: {1,2,3}, {1,2,5}, {1,3,4}, {1,3,6}, {1,4,5}, {1,5,6}, {2,3,5}, {2,4,6}, {3,4,5}, {3,5,6}.
A(2,3) = 5: {1,2}, {1,5}, {2,4}, {3,6}, {4,5}.
Square array A(n,k) begins:
  1, 1,    1,     1,      1,       1,       1,        1, ...
  0, 1,    1,     1,      1,       1,       1,        1, ...
  0, 1,    2,     5,      6,       9,      10,       13, ...
  0, 1,   10,    30,     55,      91,     138,      190, ...
  0, 1,   38,   165,    460,     969,    1782,     2925, ...
  0, 1,  126,  1001,   3876,   10630,   23751,    46376, ...
  0, 1,  452,  6198,  33594,  118755,  324516,   749398, ...
  0, 1, 1716, 38760, 296010, 1344904, 4496388, 12271518, ...
		

Crossrefs

Main diagonal gives A318477.

Programs

  • Mathematica
    nmax = 11; (* Program not suitable to compute a large number of terms. *)
    A[n_, k_] := A[n, k] = Count[Subsets[Range[k n], {n}], s_ /; Divisible[Total[s], k]]; A[0, _] = 1;
    Table[A[n - k, k], {n, 0, nmax}, {k, n, 0, -1}] // Flatten (* Jean-François Alcover, Oct 04 2019 *)

A282011 Number T(n,k) of k-element subsets of [n] having an even sum; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 2, 4, 6, 3, 0, 1, 3, 6, 10, 9, 3, 0, 1, 3, 9, 19, 19, 9, 3, 1, 1, 4, 12, 28, 38, 28, 12, 4, 1, 1, 4, 16, 44, 66, 60, 40, 20, 5, 0, 1, 5, 20, 60, 110, 126, 100, 60, 25, 5, 0, 1, 5, 25, 85, 170, 226, 226, 170, 85, 25, 5, 1, 1, 6, 30, 110, 255, 396, 452, 396, 255, 110, 30, 6, 1
Offset: 0

Views

Author

Alois P. Heinz, Feb 04 2017

Keywords

Comments

Row n is symmetric if and only if n mod 4 in {0,3} (or if T(n,n) = 1).

Examples

			T(5,0) = 1: {}.
T(5,1) = 2: {2}, {4}.
T(5,2) = 4: {1,3}, {1,5}, {2,4}, {3,5}.
T(5,3) = 6: {1,2,3}, {1,2,5}, {1,3,4}, {1,4,5}, {2,3,5}, {3,4,5}.
T(5,4) = 3: {1,2,3,4}, {1,2,4,5}, {2,3,4,5}.
T(5,5) = 0.
T(7,7) = 1: {1,2,3,4,5,6,7}.
Triangle T(n,k) begins:
  1;
  1, 0;
  1, 1,  0;
  1, 1,  1,   1;
  1, 2,  2,   2,   1;
  1, 2,  4,   6,   3,   0;
  1, 3,  6,  10,   9,   3,   0;
  1, 3,  9,  19,  19,   9,   3,   1;
  1, 4, 12,  28,  38,  28,  12,   4,   1;
  1, 4, 16,  44,  66,  60,  40,  20,   5,   0;
  1, 5, 20,  60, 110, 126, 100,  60,  25,   5,  0;
  1, 5, 25,  85, 170, 226, 226, 170,  85,  25,  5, 1;
  1, 6, 30, 110, 255, 396, 452, 396, 255, 110, 30, 6, 1;
		

Crossrefs

Columns k=0..10 give (offsets may differ): A000012, A004526, A002620, A005993, A005994, A032092, A032093, A018211, A018212, A282077, A282078.
Row sums give A011782.
Main diagonal gives A133872(n+1).
Lower diagonals T(n+j,n) for j=1..10 give: A004525(n+1), A282079, A228705, A282080, A282081, A282082, A282083, A282084, A282085, A282086.
T(2n,n) gives A119358.

Programs

  • Maple
    b:= proc(n, s) option remember; expand(
          `if`(n=0, s, b(n-1, s)+x*b(n-1, irem(s+n, 2))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..n))(b(n, 1)):
    seq(T(n), n=0..16);
  • Mathematica
    Flatten[Table[Sum[Binomial[Ceiling[n/2],2j]Binomial[Floor[n/2],k-2j],{j,0,Floor[(n+1)/4]}],{n,0,10},{k,0,n}]] (* Indranil Ghosh, Feb 26 2017 *)
  • PARI
    a(n,k)=sum(j=0,floor((n+1)/4),binomial(ceil(n/2),2*j)*binomial(floor(n/2),k-2*j));
    tabl(nn)={for(n=0,nn,for(k=0,n,print1(a(n,k),", "););print(););} \\ Indranil Ghosh, Feb 26 2017

Formula

T(n,k) = Sum_{j=0..floor((n+1)/4)} C(ceiling(n/2),2*j) * C(floor(n/2),k-2*j).
T(n,k) = A007318(n,k) - A159916(n,k).
Sum_{k=0..n} k * T(n,k) = A057711(n-1) for n>0.
Sum_{k=0..n} (k+1) * T(n,k) = A087447(n) + [n=2].

A119326 Number triangle T(n,k) = Sum_{j=0..n-k} C(k,2j)*C(n-k,2j).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 4, 4, 1, 1, 1, 1, 7, 10, 7, 1, 1, 1, 1, 11, 19, 19, 11, 1, 1, 1, 1, 16, 31, 38, 31, 16, 1, 1, 1, 1, 22, 46, 66, 66, 46, 22, 1, 1, 1, 1, 29, 64, 106, 126, 106, 64, 29, 1, 1, 1, 1, 37, 85, 162, 226, 226, 162, 85, 37, 1, 1
Offset: 0

Views

Author

Paul Barry, May 14 2006

Keywords

Comments

Third column is essentially A000124. Fourth column is essentially A005448. Fifth column is A119327. Product of Pascal's triangle A007318 and A119328. Row sums are A038504. T(n,k) = T(n,n-k).

Examples

			Triangle begins:
  1;
  1, 1;
  1, 1,  1;
  1, 1,  1,  1;
  1, 1,  2,  1,  1;
  1, 1,  4,  4,  1,  1;
  1, 1,  7, 10,  7,  1, 1;
  1, 1, 11, 19, 19, 11, 1, 1;
  ...
		

References

  • Lukas Spiegelhofer and Jeffrey Shallit, Continuants, Run Lengths, and Barry's Modified Pascal Triangle, Volume 26(1) 2019, of The Electronic Journal of Combinatorics, #P1.31.

Crossrefs

Cf. A119358.

Formula

Column k has g.f.: (x^k/(1-x))* Sum{j=0..k} C(k,2j)*(x/(1-x))^(2j).
T(2n,n) = A119358(n). - Alois P. Heinz, Aug 31 2018

A169888 Number of n-member subsets of 1..2n whose elements sum to a multiple of n.

Original entry on oeis.org

1, 2, 2, 8, 18, 52, 152, 492, 1618, 5408, 18452, 64132, 225432, 800048, 2865228, 10341208, 37568338, 137270956, 504171584, 1860277044, 6892335668, 25631327688, 95640829924, 357975249028, 1343650267288, 5056424257552, 19073789328752, 72108867620204
Offset: 0

Views

Author

N. J. A. Sloane, Jul 07 2010, based on a letter from Jean-Claude Babois

Keywords

Comments

This is twice A145855 (for n>0), which is the main entry for this problem.

Crossrefs

Programs

  • Maple
    with(combinat): t0:=[]; for n from 1 to 8 do ans:=0; t1:=choose(2*n,n); for i in t1 do s1:=add(i[j],j=1..n); if s1 mod n = 0 then ans:=ans+1; fi; od: t0:=[op(t0),ans]; od:
  • Mathematica
    a[n_] := Sum[(-1)^(n+d)*EulerPhi[n/d]*Binomial[2d, d]/n, {d, Divisors[n]}]; Table[a[n], {n, 1, 26}] (* Jean-François Alcover, Oct 22 2012, after T. D. Noe's program in A145855 *)
  • PARI
    a(n) = if(n==0, 1, sumdiv(n, d, (-1)^(n+d)*eulerphi(n/d)*binomial(2*d, d)/n)); \\ Altug Alkan, Aug 27 2018, after T. D. Noe at A145855

Formula

a(n) = A061865(2n,n). - Alois P. Heinz, Aug 28 2018
a(n) ~ 2^(2*n) / (sqrt(Pi) * n^(3/2)). - Vaclav Kotesovec, Mar 28 2023

Extensions

a(0)=1 prepended by Alois P. Heinz, Aug 26 2018

A119363 a(n) = Sum_{k=0..n} C(n,3k)^2.

Original entry on oeis.org

1, 1, 1, 2, 17, 101, 402, 1275, 3921, 14114, 58601, 243695, 950578, 3537847, 13166791, 50514102, 198627921, 782913717, 3054480306, 11824753551, 45823049817, 178682390994, 700285942731, 2747647985241, 10767833451954, 42164261091351, 165225573240651
Offset: 0

Views

Author

Paul Barry, May 16 2006

Keywords

Comments

a(n) - A119364(n) = A119365(n).

Crossrefs

Central coefficients of number triangle A119335.
a(n) = A119335(2n, n).

Programs

  • Mathematica
    Table[Sum[Binomial[n,3k]^2, {k,0,n}], {n,0,30}] (* Vaclav Kotesovec, Mar 12 2019 *)
    Table[HypergeometricPFQ[{1/3 - n/3, 1/3 - n/3, 2/3 - n/3, 2/3 - n/3, -n/3, -n/3}, {1/3, 1/3, 2/3, 2/3, 1}, 1], {n, 0, 30}] (* Vaclav Kotesovec, Mar 12 2019 *)

Formula

From Vaclav Kotesovec, Mar 12 2019: (Start)
Recurrence: (n-2)*(n-1)*n*(637*n^6 - 11466*n^5 + 84364*n^4 - 324394*n^3 + 686227*n^2 - 755060*n + 336132)*a(n) = 3*(n-2)*(n-1)*(1274*n^7 - 23569*n^6 + 180194*n^5 - 733383*n^4 + 1699606*n^3 - 2208294*n^2 + 1449504*n - 351000)*a(n-1) - 3*(n-2)*(3185*n^8 - 63700*n^7 + 539028*n^6 - 2512118*n^5 + 7020469*n^4 - 11971242*n^3 + 12050010*n^2 - 6446736*n + 1362744)*a(n-2) + (14014*n^9 - 315315*n^8 + 3072678*n^7 - 16986046*n^6 + 58535088*n^5 - 129861691*n^4 + 184326992*n^3 - 159830656*n^2 + 75517728*n - 14313456)*a(n-3) + 3*(n-3)*(3185*n^8 - 63700*n^7 + 538391*n^6 - 2501394*n^5 + 6946794*n^4 - 11707256*n^3 + 11530544*n^2 - 5915328*n + 1142208)*a(n-4) + 18*(n-4)*(n-3)*(2*n - 9)*(637*n^6 - 7644*n^5 + 36589*n^4 - 88858*n^3 + 114124*n^2 - 71840*n + 16440)*a(n-5).
a(n) ~ 4^n / (3*sqrt(Pi*n)). (End)

Extensions

Edited by N. J. A. Sloane, Jun 12 2008

A071688 Number of plane trees with even number of leaves.

Original entry on oeis.org

0, 1, 3, 7, 20, 66, 217, 715, 2424, 8398, 29414, 104006, 371384, 1337220, 4847637, 17678835, 64821680, 238819350, 883634026, 3282060210, 12233125112, 45741281820, 171529836218, 644952073662, 2430973096720, 9183676536076, 34766775829452, 131873975875180, 501121106988464
Offset: 1

Views

Author

Sen-peng Eu, Jun 23 2002

Keywords

Comments

Number of Dyck n-paths with an even number of peaks (or, equivalently, odd number of valleys). - Yu Hin Au, Dec 07 2019

Examples

			a(3) = 3 because among the 5 plane 3-trees there are 3 trees with even number of leaves; a(4) = 7 because among the 14 plane 4-trees there are 7 trees with even number of leaves.
		

Crossrefs

a(n) + A071684 = A000108: Catalan numbers.
Cf. A007595.

Programs

  • Magma
    [ &+[2*k*Binomial(n,2*k)^2/(n*(n-2*k+1)): k in [0..Floor(n/2)]] : n in [1..30]]; // G. C. Greubel, Dec 10 2019
    
  • Maple
    seq( add(2*k*binomial(n,2*k)^2/(n*(n-2*k+1)), k=0..floor(n/2)), n=1..30); # G. C. Greubel, Dec 10 2019
  • Mathematica
    a[n_] := If[EvenQ[n], Binomial[2n, n]/(2n + 2), Binomial[2n, n]/(2n + 2) + (-1)^((n + 1)/2)Binomial[n - 1, (n - 1)/2]/(n + 1)]
    Table[(CatalanNumber[n] - 2^n Binomial[1/2, (n + 1)/2])/2, {n, 20}] (* Vladimir Reshetnikov, Oct 03 2016 *)
  • PARI
    a(n) = 0^n + sum(k=1, n, (1/n)*binomial(n,k)*binomial(n,k-1)*(1+(-1)^k)/2); \\ Michel Marcus, Dec 09 2019
    
  • Sage
    [ sum(2*k*binomial(n,2*k)^2/(n*(n-2*k+1)) for k in (0..floor(n/2))) for n in (1..30)] # G. C. Greubel, Dec 10 2019

Formula

a(2n) = (1/(4*n+2))*binomial(4*n, 2*n), a(2n+1) = (1/(4*n+4))*binomial(4*n+2, 2*n+1) + (-1)^(n+1)*(1/(2*n+2))*binomial(2*n, n).
G.f.: (1/4)*(2-(1-4*x)^(1/2) + 2*x - (1+4*x^2)^(1/2))/x. - Vladeta Jovovic, Apr 19 2003
a(0)=1, a(n) = Sum_{k=0..floor(n/2)} (1/n)*C(n,2k-1)*C(n,2k), n>0. - Paul Barry, Jan 25 2007
a(n) = 0^n + Sum_{k=1..n} (1/n)*C(n,k)*C(n,k-1)*(1+(-1)^k)/2. - Paul Barry, Dec 16 2008
a(n) = Sum_{k=0..n} Sum_{j=0..n-k} (-1)^j*(C(n,2*k)*C(n,2*k+j) - C(n,2*k-1)*C(n,2*k+j+1)). - Paul Barry, Sep 13 2010
n*(n+1)*a(n) -2*n*(n+1)*a(n-1) - 4*(2*n^2 -10*n +9)*a(n-2) +8*(n^2 -11*n + 21)*a(n-3) -48*(n-3)*(n-4)*a(n-4) + 32*(2*n-9)*(n-5)*a(n-5) = 0. - R. J. Mathar, Nov 24 2012 (corrected by Yu Hin Au, Dec 09 2019 )
a(n) = (A000108(n) - 2^n * binomial(1/2, (n+1)/2))/2. - Vladimir Reshetnikov, Oct 03 2016
From Vaclav Kotesovec, Oct 04 2016: (Start)
Recurrence (of order 3): n*(n+1)*(5*n^2 - 20*n + 18)*a(n) = 2*n*(2*n - 5)*(5*n^2 - 10*n + 3)*a(n-1) - 4*(n-2)*n*(5*n^2 - 20*n + 18)*a(n-2) + 8*(n-3)*(2*n - 5)*(5*n^2 - 10*n + 3)*a(n-3).
a(n) ~ 2^(2*n-1)/(sqrt(Pi*n)*n).
(End)
a(n) = A119358(n) - A119359(n) = hypergeom([1/2-n/2, 1/2-n/2, -n/2, -n/2], [1/2, 1/2, 1], 1) - hypergeom([-1/2-n/2, 1/2-n/2, 1-n/2, -n/2], [1/2, 1/2, 1], 1). - Vladimir Reshetnikov, Oct 05 2016

Extensions

Edited by Robert G. Wilson v, Jun 25 2002

A318477 Number of n-member subsets of [n^2] whose elements sum to a multiple of n.

Original entry on oeis.org

1, 1, 2, 30, 460, 10630, 324516, 12271518, 553275192, 28987537806, 1731030733840, 116068178638786, 8634941165110140, 705873715441872276, 62895036883536770108, 6067037854078500844740, 629921975126483973659888, 70043473196734767582082246
Offset: 0

Views

Author

Alois P. Heinz, Aug 26 2018

Keywords

Examples

			a(0) = 1: {}.
a(1) = 1: {1}.
a(2) = 2: {1,3}, {2,4}.
a(3) = 30: {1,2,3}, {1,2,6}, {1,2,9}, {1,3,5}, {1,3,8}, {1,4,7}, {1,5,6}, {1,5,9}, {1,6,8}, {1,8,9}, {2,3,4}, {2,3,7}, {2,4,6}, {2,4,9}, {2,5,8}, {2,6,7}, {2,7,9}, {3,4,5}, {3,4,8}, {3,5,7}, {3,6,9}, {3,7,8}, {4,5,6}, {4,5,9}, {4,6,8}, {4,8,9}, {5,6,7}, {5,7,9}, {6,7,8}, {7,8,9}.
		

Crossrefs

Main diagonal of A304482 and of A318557.

Programs

  • Maple
    with(numtheory):
    a:= proc(n) option remember; `if`(n=0, 1, add(phi(n/d)*
          (-1)^(n+d)*binomial(n*d, d), d=divisors(n))/n)
        end:
    seq(a(n), n=0..20);
  • Mathematica
    a[n_] := (-1)^n Sum[(-1)^d Binomial[d n, d] EulerPhi[n/d], {d, Divisors[n]} ]/n; a[0] = 1;
    a /@ Range[0, 20] (* Jean-François Alcover, Sep 23 2019 *)

Formula

a(n) = n * A308667(n) for n >= 1.
a(n) ~ exp(n - 1/2) * n^(n - 3/2) / sqrt(2*Pi). - Vaclav Kotesovec, Mar 28 2023

A307091 a(n) = Sum_{k=0..floor(n/2)} (-1)^k * binomial(n,2*k)^2.

Original entry on oeis.org

1, 1, 0, -8, -34, -74, 0, 736, 3334, 7606, 0, -80464, -372436, -864772, 0, 9400192, 43976774, 103061158, 0, -1137528688, -5355697084, -12623082284, 0, 140697113792, 665238165916, 1574005263676, 0, -17663830073504, -83769667651816, -198760191043784, 0
Offset: 0

Views

Author

Seiichi Manyama, Mar 24 2019

Keywords

Crossrefs

Central coefficients of number triangle A307090.

Programs

  • Mathematica
    Table[Sum[(-1)^k*Binomial[n, 2*k]^2, {k, 0, Floor[n/2]}], {n, 0, 30}] (* Vaclav Kotesovec, Mar 24 2019 *)
    Table[HypergeometricPFQ[{1/2 - n/2, 1/2 - n/2, -n/2, -n/2}, {1/2, 1/2, 1}, -1], {n, 0, 30}] (* Vaclav Kotesovec, Mar 24 2019 *)
  • PARI
    {a(n) = sum(k=0, n\2, (-1)^k*binomial(n, 2*k)^2)}

Formula

a(4*n+2) = 0 for n >= 0.
From Peter Bala, Mar 17 2023: (Start)
n*(n-1)*(6*n^2-24*n+23)a(n) = 4*(n-1)*(2*n-3)*(3*n^2-9*n+4)*a(n-1) - 4*(3*n^2-9*n+4)*(2*n-3)^2*a(n-2) - 8*(n-2)*(2*n-3)*(3*n^2-9*n+4)*a(n-3) - 4*(n-2)*(n-3)*(6*n^2-12*n+5)*a(n-4) with a(0) = 1, a(1) = 1, a(2) = 0 and a(3) = -8.
a(n) = hypergeom([(1-n)/2, (1-n)/2, -n/2, -n/2], [1/2, 1/2, 1], -1).
Conjecture: the supercongruence a(n*p^r) == a(n*p^(r-1)) (mod p^(2*r)) holds for positive integers n and r and all primes p >= 3. (End)

A119359 Central coefficients of number triangle A119326.

Original entry on oeis.org

0, 1, 1, 7, 31, 106, 386, 1499, 5755, 21886, 83854, 323302, 1248534, 4828916, 18719364, 72711123, 282867795, 1101981430, 4298723990, 16788997874, 65641296578, 256895812108, 1006307847324, 3945185527582, 15478851119966
Offset: 0

Views

Author

Paul Barry, May 16 2006

Keywords

Comments

a(n) = A119326(2n,n+1). A119358(n)-a(n) = A071688(n).

Programs

  • Mathematica
    Table[HypergeometricPFQ[{-1/2 - n/2, 1/2 - n/2, 1 - n/2, -n/2}, {1/2, 1/2, 1}, 1] - KroneckerDelta[n], {n, 0, 20}] (* Vladimir Reshetnikov, Oct 04 2016 *)
    Table[(2^n Binomial[1/2, (n+1)/2]  + Binomial[n, n/2] Cos[Pi n/2] + n CatalanNumber[n])/2 - KroneckerDelta[n], {n, 0, 20}] (* Vladimir Reshetnikov, Oct 06 2016 *)

Formula

G.f.: (1/sqrt(1-4x)+(1/sqrt(1+4x^2)-1)-c(x)+x*c(-x^2))/2, c(x) the g.f. of A000108;
a(n) = (C(2n,n+1)+C((n-1)/2)*sin(Pi*n/2)-2*0^n-2C(n-1,n/2)*sin(Pi*(n-1)/2))/2.
a(n) = hypergeom([-1/2-n/2, 1/2-n/2, 1-n/2, -n/2], [1/2, 1/2, 1], 1) - 0^n. - Vladimir Reshetnikov, Oct 04 2016
Showing 1-9 of 9 results.