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 29 results. Next

A051293 Number of nonempty subsets of {1,2,3,...,n} whose elements have an integer average.

Original entry on oeis.org

1, 2, 5, 8, 15, 26, 45, 76, 135, 238, 425, 768, 1399, 2570, 4761, 8856, 16567, 31138, 58733, 111164, 211043, 401694, 766417, 1465488, 2807671, 5388782, 10359849, 19946832, 38459623, 74251094, 143524761, 277742488, 538043663, 1043333934, 2025040765, 3933915348
Offset: 1

Views

Author

John W. Layman, Oct 30 1999

Keywords

Comments

a(n) is asymptotic to 2^(n+1)/n. More precisely, I conjecture for any m > 0, a(n) = 2^(n+1)/n * Sum_{k=0..m} A000670(k)/n^k + o(1/n^(m+1)) (A000670 = preferential arrangements of n labeled elements) which can be written a(n) = 2^n/n * 2 + Sum_{k=1..m} A000629(k)/n^k + o(1/n^(m+1)) (A000629 = necklaces of sets of labeled beads). In fact I conjecture that a(n) = 2^(n+1)/n * (1 + 1/n + 3/n^2 + 13/n^3 + 75/n^4 + 541/n^5 + o(1/n^5)). - Benoit Cloitre, Oct 20 2002
A082550(n) = a(n+1) - a(n). - Reinhard Zumkeller, Feb 19 2006

Examples

			a(4) = 8 because each of the 8 subsets {1}, {2}, {3}, {4}, {1,3}, {2,4}, {1,2,3}, {2,3,4} has an integer average.
		

Crossrefs

Row sums of A061865 and A327481.

Programs

  • Maple
    with(numtheory):
    b:= n-> add(2^(n/d)*phi(d), d=select(x-> x::odd, divisors(n)))/n:
    a:= proc(n) option remember; `if`(n<1, 0, b(n)-1+a(n-1)) end:
    seq(a(n), n=1..40);  # Alois P. Heinz, Jul 15 2019
  • Mathematica
    Table[ Sum[a = Select[Divisors[i], OddQ[ # ] & ]; Apply[Plus, 2^(i/a)*EulerPhi[a]]/i, {i, n}] - n, {n, 34}]
    Table[Count[Subsets[Range[n]],?(IntegerQ[Mean[#]]&)],{n,35}] (* _Harvey P. Dale, Apr 14 2018 *)
  • PARI
    a(n)=sum(k=1,n,sumdiv(k,d,d%2*2^(k/d)*eulerphi(d))/k-1)
    
  • Python
    from sympy import totient, divisors
    def A051293(n): return sum((sum(totient(d)<>(~k&k-1).bit_length(),generator=True))<<1)//k for k in range(1,n+1))-n # Chai Wah Wu, Feb 22 2023

Formula

a(n) = Sum_{i=1..n} (A063776(i) - 1).

Extensions

Extended by Robert G. Wilson v, Oct 16 2002

A006134 a(n) = Sum_{k=0..n} binomial(2*k,k).

Original entry on oeis.org

1, 3, 9, 29, 99, 351, 1275, 4707, 17577, 66197, 250953, 956385, 3660541, 14061141, 54177741, 209295261, 810375651, 3143981871, 12219117171, 47564380971, 185410909791, 723668784231, 2827767747951, 11061198475551, 43308802158651, 169719408596403, 665637941544507
Offset: 0

Views

Author

Keywords

Comments

The expression a(n) = B^n*Sum_{ k=0..n } binomial(2*k,k)/B^k gives A006134 for B=1, A082590 (B=2), A132310 (B=3), A002457 (B=4), A144635 (B=5). - N. J. A. Sloane, Jan 21 2009
T(n+1,1) from table A045912 of characteristic polynomial of negative Pascal matrix. - Michael Somos, Jul 24 2002
p divides a((p-3)/2) for p=11, 13, 23, 37, 47, 59, 61, 71, 73, 83, 97, 107, 109, 131, 157, 167, ...: A097933. Also primes congruent to {1, 2, 3, 11} mod 12 or primes p such that 3 is a square mod p (excluding 2 and 3) A038874. - Alexander Adamchuk, Jul 05 2006
Partial sums of the even central binomial coefficients. For p prime >=5, a(p-1) = 1 or -1 (mod p) according as p = 1 or -1 (mod 3) (see Pan and Sun link). - David Callan, Nov 29 2007
First column of triangle A187887. - Michel Marcus, Jun 23 2013
From Gus Wiseman, Apr 20 2023: (Start)
Also the number of nonempty subsets of {1,...,2n+1} with median n+1, where the median of a multiset is either the middle part (for odd length), or the average of the two middle parts (for even length). The odd/even-length cases are A000984 and A006134(n-1). For example, the a(0) = 1 through a(2) = 9 subsets are:
{1} {2} {3}
{1,3} {1,5}
{1,2,3} {2,4}
{1,3,4}
{1,3,5}
{2,3,4}
{2,3,5}
{1,2,4,5}
{1,2,3,4,5}
Alternatively, a(n-1) is the number of nonempty subsets of {1,...,2n-1} with median n.
(End)

Examples

			1 + 3*x + 9*x^2 + 29*x^3 + 99*x^4 + 351*x^5 + 1275*x^6 + 4707*x^7 + 17577*x^8 + ...
		

References

  • Marko Petkovsek, Herbert Wilf and Doron Zeilberger, A=B, A K Peters, 1996, p. 22.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000984 (first differences), A097933, A038874, A132310.
Equals A066796 + 1.
Odd bisection of A100066.
Row sums of A361654 (also column k = 2).
A007318 counts subsets by length, A231147 by median, A013580 by integer median.
A359893 and A359901 count partitions by median.

Programs

  • MATLAB
    n=10; x=pascal(n); trace(x)
    
  • Magma
    &cat[ [&+[ Binomial(2*k, k): k in [0..n]]]: n in [0..30]]; // Vincenzo Librandi, Aug 13 2015
  • Maple
    A006134 := proc(n) sum(binomial(2*k,k),k=0..n); end;
    a := n -> -binomial(2*(n+1),n+1)*hypergeom([1,n+3/2],[n+2], 4) - I/sqrt(3):
    seq(simplify(a(n)), n=0..24); # Peter Luschny, Oct 29 2015
    # third program:
    A006134 := series(exp(2*x)*BesselI(0, 2*x) + exp(x)*int(BesselI(0, 2*x)*exp(x), x), x = 0, 25):
    seq(n!*coeff(A006134, x, n), n=0..24); # Mélika Tebni, Feb 27 2024
  • Mathematica
    Table[Sum[((2k)!/(k!)^2),{k,0,n}], {n,0,50}] (* Alexander Adamchuk, Jul 05 2006 *)
    a[ n_] := (4/3) Binomial[ 2 n, n] Hypergeometric2F1[ 1/2, 1, -n + 1/2, -1/3] (* Michael Somos, Jun 20 2012 *)
    Accumulate[Table[Binomial[2n,n],{n,0,30}]] (* Harvey P. Dale, Jan 11 2015 *)
    CoefficientList[Series[1/((1 - x) Sqrt[1 - 4 x]), {x, 0, 33}], x] (* Vincenzo Librandi, Aug 13 2015 *)
  • Maxima
    makelist(sum(binomial(2*k,k),k,0,n),n,0,12); /* Emanuele Munarini, Mar 15 2011 */
    
  • PARI
    {a(n) = if( n<0, 0, polcoeff( charpoly( matrix( n+1, n+1, i, j, -binomial( i+j-2, i-1))), 1))} \\ Michael Somos, Jul 10 2002
    
  • PARI
    {a(n)=binomial(2*n,n)*sum(k=0,2*n,(-1)^k*polcoeff((1+x+x^2)^n,k)/binomial(2*n,k))} \\ Paul D. Hanna, Aug 21 2007
    
  • PARI
    my(x='x+O('x^100)); Vec(1/((1-x)*sqrt(1-4*x))) \\ Altug Alkan, Oct 29 2015
    

Formula

From Alexander Adamchuk, Jul 05 2006: (Start)
a(n) = Sum_{k=0..n} (2k)!/(k!)^2.
a(n) = A066796(n) + 1, n>0. (End)
G.f.: 1/((1-x)*sqrt(1-4*x)).
D-finite with recurrence: (n+2)*a(n+2) - (5*n+8)*a(n+1) + 2*(2*n+3)*a(n) = 0. - Emanuele Munarini, Mar 15 2011
a(n) = C(2n,n) * Sum_{k=0..2n} (-1)^k*trinomial(n,k)/C(2n,k) where trinomial(n,k) = [x^k] (1 + x + x^2)^n. E.g. a(2) = C(4,2)*(1/1 - 2/4 + 3/6 - 2/4 + 1/1) = 6*(3/2) = 9 ; a(3) = C(6,3)*(1/1 - 3/6 + 6/15 - 7/20 + 6/15 - 3/6 + 1/1) = 20*(29/20) = 29. - Paul D. Hanna, Aug 21 2007
From Alzhekeyev Ascar M, Jan 19 2012: (Start)
a(n) = Sum_{ k=0..n } b(k)*binomial(n+k,k), where b(k)=0 for n-k == 2 (mod 3), b(k)=1 for n-k == 0 or 1 (mod 6), and b(k)=-1 for n-k== 3 or 4 (mod 6).
a(n) = Sum_{ k=0..n-1 } c(k)*binomial(2n,k) + binomial(2n,n), where c(k)=0 for n-k == 0 (mod 3), c(k)=1 for n-k== 1 (mod 3), and c(k)=-1 for n-k==2 (mod 3). (End)
a(n) ~ 2^(2*n+2)/(3*sqrt(Pi*n)). - Vaclav Kotesovec, Nov 06 2012
G.f.: G(0)/2/(1-x), where G(k)= 1 + 1/(1 - 2*x*(2*k+1)/(2*x*(2*k+1) + (k+1)/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, May 24 2013
G.f.: G(0)/(1-x), where G(k)= 1 + 4*x*(4*k+1)/( (4*k+2) - x*(4*k+2)*(4*k+3)/(x*(4*k+3) + (k+1)/G(k+1))); (continued fraction). - Sergei N. Gladkovskii, Jun 26 2013
a(n) = Sum_{k = 0..n} binomial(n+1,k+1)*A002426(k). - Peter Bala, Oct 29 2015
a(n) = -binomial(2*(n+1),n+1)*hypergeom([1,n+3/2],[n+2], 4) - i/sqrt(3). - Peter Luschny, Oct 29 2015
a(n) = binomial(2*n, n)*hypergeom([1,-n], [1/2-n], 1/4). - Peter Luschny, Mar 16 2016
From Gus Wiseman, Apr 20 2023: (Start)
a(n+1) - a(n) = A000984(n).
a(n) = A013580(2n+1,n+1) (conjectured).
a(n) = 2*A024718(n) - 1.
a(n) = A100066(2n+1).
a(n) = A231147(2n+1,n+1) (conjectured). (End)
a(n) = Sum_{k=0..floor(n/3)} 3^(n-3*k) * binomial(n-k,2*k) * binomial(2*k,k) (Sawhney, 2017). - Amiram Eldar, Feb 24 2024
From Mélika Tebni, Feb 27 2024: (Start)
Limit_{n -> oo} a(n) / A281593(n) = 2.
E.g.f.: exp(2*x)*BesselI(0,2*x) + exp(x)*integral( BesselI(0,2*x)*exp(x) ) dx. (End)
a(n) = [(x*y)^n] 1/((1 - (x + y))*(1 - x*y)). - Stefano Spezia, Feb 16 2025
a(n) = Sum_{k=0..floor(n/2)} (-1)^k*binomial(2*n+1-k, n-2*k). - Michael Weselcouch, Jun 17 2025
a(n) = binomial(1+2*n, n)*hypergeom([1, (1-n)/2, -n/2], [-1-2*n, 2+n], 4). - Stefano Spezia, Jun 18 2025

Extensions

Simpler definition from Alexander Adamchuk, Jul 05 2006

A327482 Irregular triangle read by rows where T(n,k) is the number of integer partitions of n with mean d = A027750(n, k).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 5, 4, 1, 1, 7, 1, 1, 7, 5, 1, 1, 1, 1, 11, 15, 12, 6, 1, 1, 1, 1, 15, 7, 1, 1, 30, 19, 1, 1, 22, 34, 8, 1, 1, 1, 1, 30, 58, 27, 9, 1, 1, 1, 1, 42, 84, 64, 10, 1, 1, 105, 37, 1, 1, 56, 11, 1
Offset: 1

Views

Author

Gus Wiseman, Sep 13 2019

Keywords

Examples

			Triangle begins:
  1
  1  1
  1  1
  1  2  1
  1  1
  1  3  3  1
  1  1
  1  5  4  1
  1  7  1
  1  7  5  1
  1  1
  1 11 15 12  6  1
  1  1
  1 15  7  1
  1 30 19  1
  1 22 34  8  1
		

Crossrefs

Row sums are A067538.
The version for subsets is A327481.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n],Mean[#]==d&]],{n,20},{d,Divisors[n]}]

Extensions

Name edited by Peter Munn, Mar 05 2025

A079309 a(n) = C(1,1) + C(3,2) + C(5,3) + ... + C(2*n-1,n).

Original entry on oeis.org

1, 4, 14, 49, 175, 637, 2353, 8788, 33098, 125476, 478192, 1830270, 7030570, 27088870, 104647630, 405187825, 1571990935, 6109558585, 23782190485, 92705454895, 361834392115, 1413883873975, 5530599237775, 21654401079325, 84859704298201, 332818970772253
Offset: 1

Views

Author

Miklos Kristof, Feb 10 2003

Keywords

Comments

a(n) is the sum of pyramid weights of all Dyck paths of length 2n (for pyramid weight see Denise and Simion). Equivalently, a(n) is the sum of the total lengths of end branches of an ordered tree, summation being over all ordered trees with n edges. For example, the five ordered trees with 3 edges have total lengths of endbranches 3,2,3,3 and 3. - Emeric Deutsch, May 30 2003
a(n) is the number of Motzkin paths of length 2n with exactly one level segment. (A level segment is a maximal sequence of contiguous flatsteps.) Example: for n=2, the paths counted are FFFF, FFUD, UDFF, UFFD. The formula for a(n) below counts these paths by length of the level segment. - David Callan, Jul 15 2004
The inverse Catalan transform yields A024495, shifted once left. - R. J. Mathar, Jul 07 2009
From Paul Barry, Mar 29 2010: (Start)
Hankel transform is A138341.
The aerated sequence 0, 0, 1, 0, 4, 0, 14, 0, 49, ... has e.g.f. int(cosh(x-t)*Bessel_I(1,2t), t = 0..x). (End)
a(n) is the number of terms of A031443 not exceeding 4^n. - Vladimir Shevelev, Oct 01 2010
Also the number of nonempty subsets of {1..2n} with median n, bisection of A361801. The version containing n is A001700 (bisected). Replacing 2n with 2n+1 and n with n+1 gives A006134. For mean instead of median we have A212352. - Gus Wiseman, Apr 16 2023

Examples

			a(4) = C(1,1) + C(3,2) + C(5,3) + C(7,4) = 1 + 3 + 10 + 35 = 49.
G.f. = x + 4*x^2 + 14*x^3 + 49*x^4 + 175*x^5 + 637*x^6 + 2353*x^7 + ...
From _Gus Wiseman_, Apr 16 2023: (Start)
The a(1) = 1 through a(3) = 14 subsets of {1..2n} with median n:
  {1}  {2}      {3}
       {1,3}    {1,5}
       {1,2,3}  {2,4}
       {1,2,4}  {1,3,4}
                {1,3,5}
                {1,3,6}
                {2,3,4}
                {2,3,5}
                {2,3,6}
                {1,2,4,5}
                {1,2,4,6}
                {1,2,3,4,5}
                {1,2,3,4,6}
                {1,2,3,5,6}
(End)
		

Crossrefs

Equals A024718(n) - 1.
This is the even (or odd) bisection of A361801.
A007318 counts subsets by length, A327481 by mean, A013580 by median.
A359893 and A359901 count partitions by median.

Programs

  • Maple
    a := n -> add(binomial(2*j, j)/2, j=1..n): seq(a(n), n=1..24); # Zerinvary Lajos, Oct 25 2006
    a := n -> add(abs(binomial(-j, -2*j)), j=1..n): seq(a(n), n=1..24); # Zerinvary Lajos, Oct 03 2007
    f:= gfun:-rectoproc({n*a(n) +(-5*n+2)*a(n-1) +2*(2*n-1)*a(n-2)=0,a(1)=1,a(2)=4},a(n),remember):
    map(f, [$1..100]); # Robert Israel, Jun 24 2015
  • Mathematica
    Rest[CoefficientList[Series[(1/Sqrt[1-4*x]-1)/(1-x)/2, {x, 0, 20}], x]] (* Vaclav Kotesovec, Feb 13 2014 *)
    Accumulate[Table[Binomial[2n-1,n],{n,30}]] (* Harvey P. Dale, Jan 06 2021 *)
  • PARI
    {a(n) = sum(k=1, n, binomial(2*k - 1, k))}; /* Michael Somos, Feb 14 2006 */
    
  • PARI
    my(x='x+O('x^40)); Vec((1/sqrt(1-4*x)-1)/(1-x)/2) \\ Altug Alkan, Dec 24 2015

Formula

a(n) = (1/2)*(C(2, 1) + C(4, 2) + C(6, 3) + ... + C(2*n, n)) = A066796(n)/2. - Vladeta Jovovic, Feb 12 2003
G.f.: (1/sqrt(1 - 4*x) - 1)/(1 - x)/2. - Vladeta Jovovic, Feb 12 2003
Given g.f. A(x), then x * A(x - x^2) is g.f. of A024495. - Michael Somos, Feb 14 2006
a(n) = A066796(n)/2. - Zerinvary Lajos, Oct 25 2006
a(n) = Sum_{0 <= i <= j <= n} binomial(i+j, i). - Benoit Cloitre, Nov 25 2006
D-finite with recurrence n*a(n) + (-5*n+2)*a(n-1) + 2*(2*n-1)*a(n-2) = 0. - R. J. Mathar, Nov 30 2012
a(n) ~ 2^(2*n+1) / (3*sqrt(Pi*n)). - Vaclav Kotesovec, Feb 13 2014
a(n) = Sum_{k=0..n-1} A001700(k). - Doug Bell, Jun 23 2015
a(n) = -binomial(2*n+1, n)*hypergeom([1, n+3/2], [n+2], 4) - (i/sqrt(3) + 1)/2. - Peter Luschny, May 18 2018
From Gus Wiseman, Apr 18 2023: (Start)
a(n) = A024718(n) - 1.
a(n) = A231147(2n+1,n).
a(n) = A361801(2n) = A361801(2n+1). (End)
a(n) = Sum_{k=0..floor(n/2)} (-1)^k*binomial(2*n+2-k, n-2*k). - Michael Weselcouch, Jun 17 2025
a(n) = binomial(2*(1+n), n)*hypergeom([1, (1-n)/2, -n/2], [-2*(1+n), 3+n], 4). - Stefano Spezia, Jun 18 2025

Extensions

More terms from Antonio G. Astudillo (afg_astudillo(AT)hotmail.com), Feb 11 2003

A327475 Number of subsets of {1..n} whose mean is an integer, where {} has mean 0.

Original entry on oeis.org

1, 2, 3, 6, 9, 16, 27, 46, 77, 136, 239, 426, 769, 1400, 2571, 4762, 8857, 16568, 31139, 58734, 111165, 211044, 401695, 766418, 1465489, 2807672, 5388783, 10359850, 19946833, 38459624, 74251095, 143524762, 277742489, 538043664, 1043333935, 2025040766, 3933915349
Offset: 0

Views

Author

Gus Wiseman, Sep 13 2019

Keywords

Examples

			The a(0) = 1 through a(5) = 16 subsets:
  {}  {}   {}   {}       {}       {}
      {1}  {1}  {1}      {1}      {1}
           {2}  {2}      {2}      {2}
                {3}      {3}      {3}
                {1,3}    {4}      {4}
                {1,2,3}  {1,3}    {5}
                         {2,4}    {1,3}
                         {1,2,3}  {1,5}
                         {2,3,4}  {2,4}
                                  {3,5}
                                  {1,2,3}
                                  {1,3,5}
                                  {2,3,4}
                                  {3,4,5}
                                  {1,2,4,5}
                                  {1,2,3,4,5}
		

Crossrefs

If the subset is required to contain n, we get A063776.

Programs

  • Maple
    with(numtheory):
    b:= n-> add(2^(n/d)*phi(d), d=select(x-> x::odd, divisors(n)))/n:
    a:= proc(n) option remember; `if`(n=0, 1, b(n)-1+a(n-1)) end:
    seq(a(n), n=0..36);  # Alois P. Heinz, Jan 13 2024
  • Mathematica
    Table[Length[Select[Subsets[Range[n]],#=={}||IntegerQ[Mean[#]]&]],{n,0,10}]
  • Python
    from sympy import totient, divisors
    def A327475(n): return sum((sum(totient(d)<>(~k&k-1).bit_length(),generator=True))<<1)//k for k in range(1,n+1))-n+1 # Chai Wah Wu, Feb 22 2023

Formula

a(n) = A051293(n) + 1.

A000980 Number of ways of writing 0 as Sum_{k=-n..n} e(k)*k, where e(k) is 0 or 1.

Original entry on oeis.org

2, 4, 8, 20, 52, 152, 472, 1520, 5044, 17112, 59008, 206260, 729096, 2601640, 9358944, 33904324, 123580884, 452902072, 1667837680, 6168510256, 22903260088, 85338450344, 318995297200, 1195901750512, 4495448217544, 16940411201280, 63983233268592
Offset: 0

Views

Author

Keywords

Comments

The 4-term sequence 2,4,8,20 is the answer to the "Solitaire Army" problem, or checker-jumping puzzle. It is too short to have its own entry. See Conway et a;., Winning Ways, Vol. 2, pp. 715-717. - N. J. A. Sloane, Mar 01 2018
Number of subsets of {-n..n} with sum 0. Also the number of subsets of {0..2n} that are empty or have mean n. For median instead of mean we have twice A024718. - Gus Wiseman, Apr 23 2023

Examples

			From _Gus Wiseman_, Apr 23 2023: (Start)
The a(0) = 2 through a(2) = 8 subsets of {-n..n} with sum 0 are:
  {}   {}        {}
  {0}  {0}       {0}
       {-1,1}    {-1,1}
       {-1,0,1}  {-2,2}
                 {-1,0,1}
                 {-2,0,2}
                 {-2,-1,1,2}
                 {-2,-1,0,1,2}
(End)
		

References

  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 294.
  • E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see pp. 715-717.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

A047653(n) = a(n)/2.
Bisection of A084239. Cf. A063865, A141000.
A007318 counts subsets by length, A327481 by integer mean.
A327475 counts subsets with integer mean, A000975 integer median.

Programs

  • Haskell
    a000980 n = length $ filter ((== 0) . sum) $ subsequences [-n..n]
  • Maple
    b:= proc(n, i) option remember; `if`(n>i*(i+1)/2, 0,
          `if`(i=0, 1, 2*b(n, i-1)+b(n+i, i-1)+b(abs(n-i), i-1)))
        end:
    a:=n-> 2*b(0, n):
    seq(a(n), n=0..40); # Alois P. Heinz, Mar 10 2014
  • Mathematica
    a[n_] := SeriesCoefficient[ Product[1+x^k, {k, -n, n}], {x, 0, 0}]; a[0] = 2; Table[a[n], {n, 0, 24}](* Jean-François Alcover, Nov 28 2011 *)
    nmax = 26; d = {2}; a1 = {};
    Do[
      i = Ceiling[Length[d]/2];
      AppendTo[a1, If[i > Length[d], 0, d[[i]]]];
      d = PadLeft[d, Length[d] + 2 n] + PadRight[d, Length[d] + 2 n] +
        2 PadLeft[PadRight[d, Length[d] + n], Length[d] + 2 n];
      , {n, nmax}];
    a1 (* Ray Chandler, Mar 15 2014 *)
    Table[Length[Select[Subsets[Range[-n,n]],Total[#]==0&]],{n,0,5}] (* Gus Wiseman, Apr 23 2023 *)
  • PARI
    a(n)=polcoeff(prod(k=-n,n,1+x^k),0)
    

Formula

Constant term of Product_{k=-n..n} (1+x^k).
a(n) = Sum_i A067059(2n+1-i, i) = 2+2*Sum_j A047997(n, j); i.e., sum of alternate antidiagonals of A067059 and two more than twice row sums of A047997. - Henry Bottomley, Aug 11 2002
a(n) = A004171(n) - 2*A181765(n).
Coefficient of x^(n*(n+1)/2) in 2*Product_{k=1..n} (1+x^k)^2. - Sean A. Irvine, Oct 03 2011
From Gus Wiseman, Apr 23 2023: (Start)
a(n) = 2*A047653(n).
a(n) = A070925(2n+1) + 1.
a(n) = 2*A133406(2n+1).
a(n) = 2*(A212352(n) + 1).
a(n) = A222955(2n+1).
a(n) = 2*(A362046(2n) + 1).
(End)

Extensions

More terms from Michael Somos, Jun 10 2000

A013580 Triangle formed in same way as Pascal's triangle (A007318) except 1 is added to central element in even-numbered rows.

Original entry on oeis.org

1, 1, 1, 1, 3, 1, 1, 4, 4, 1, 1, 5, 9, 5, 1, 1, 6, 14, 14, 6, 1, 1, 7, 20, 29, 20, 7, 1, 1, 8, 27, 49, 49, 27, 8, 1, 1, 9, 35, 76, 99, 76, 35, 9, 1, 1, 10, 44, 111, 175, 175, 111, 44, 10, 1, 1, 11, 54, 155, 286, 351, 286, 155, 54, 11, 1, 1, 12, 65, 209, 441, 637, 637, 441, 209, 65
Offset: 0

Views

Author

Martin Hecko (bigusm(AT)interramp.com)

Keywords

Comments

From Gus Wiseman, Apr 19 2023: (Start)
Appears to be the number of nonempty subsets of {1,...,n} with median k, where the median of a multiset is either the middle part (for odd length), or the average of the two middle parts (for even length). For example, row n = 5 counts the following subsets:
{1} {2} {3} {4} {5}
{1,3} {1,5} {3,5}
{1,2,3} {2,4} {1,4,5}
{1,2,4} {1,3,4} {2,4,5}
{1,2,5} {1,3,5} {3,4,5}
{2,3,4}
{2,3,5}
{1,2,4,5}
{1,2,3,4,5}
Including half-steps gives A231147.
For mean instead of median we have A327481.
(End)

Examples

			Triangle begins:
   1
   1   1
   1   3   1
   1   4   4   1
   1   5   9   5   1
   1   6  14  14   6   1
   1   7  20  29  20   7   1
   1   8  27  49  49  27   8   1
   1   9  35  76  99  76  35   9   1
   1  10  44 111 175 175 111  44  10   1
   1  11  54 155 286 351 286 155  54  11   1
   1  12  65 209 441 637 637 441 209  65  12   1
		

Crossrefs

Row sums give A000975, A054106.
Central diagonal T(2n+1,n+1) appears to be A006134.
Central diagonal T(2n,n) appears to be A079309.
For partitions instead of subsets we have A359901, row sums A325347.
A000975 counts subsets with integer median.
A007318 counts subsets by length, A359893 by twice median.

Programs

  • Mathematica
    CoefficientList[CoefficientList[Series[1/(1 - (1 + y)*x)/(1 - y*x^2), {x, 0, 10}, {y, 0, 10}], x], y] // Flatten (* G. C. Greubel, Oct 10 2017 *)

Formula

G.f.: 1/(1-(1+y)*x)/(1-y*x^2). - Vladeta Jovovic, Oct 12 2003

Extensions

More terms from James Sellers

A047653 Constant term in expansion of (1/2) * Product_{k=-n..n} (1 + x^k).

Original entry on oeis.org

1, 2, 4, 10, 26, 76, 236, 760, 2522, 8556, 29504, 103130, 364548, 1300820, 4679472, 16952162, 61790442, 226451036, 833918840, 3084255128, 11451630044, 42669225172, 159497648600, 597950875256, 2247724108772, 8470205600640, 31991616634296, 121086752349064
Offset: 0

Views

Author

Keywords

Comments

Or, constant term in expansion of Product_{k=1..n} (x^k + 1/x^k)^2. - N. J. A. Sloane, Jul 09 2008
Or, maximal coefficient of the polynomial (1+x)^2 * (1+x^2)^2 *...* (1+x^n)^2.
a(n) = A000302(n) - A181765(n).
From Gus Wiseman, Apr 18 2023: (Start)
Also the number of subsets of {1..2n} that are empty or have mean n. The a(0) = 1 through a(3) = 10 subsets are:
{} {} {} {}
{1} {2} {3}
{1,3} {1,5}
{1,2,3} {2,4}
{1,2,6}
{1,3,5}
{2,3,4}
{1,2,3,6}
{1,2,4,5}
{1,2,3,4,5}
Also the number of subsets of {-n..n} with no 0's but with sum 0. The a(0) = 1 through a(3) = 10 subsets are:
{} {} {} {}
{-1,1} {-1,1} {-1,1}
{-2,2} {-2,2}
{-2,-1,1,2} {-3,3}
{-3,1,2}
{-2,-1,3}
{-2,-1,1,2}
{-3,-1,1,3}
{-3,-2,2,3}
{-3,-2,-1,1,2,3}
(End)

Crossrefs

Cf. A025591.
Cf. A053632; variant: A127728.
For median instead of mean we have A079309(n) + 1.
Odd bisection of A133406.
A000980 counts nonempty subsets of {1..2n-1} with mean n.
A007318 counts subsets by length, A327481 by mean.

Programs

  • Maple
    f:=n->coeff( expand( mul((x^k+1/x^k)^2,k=1..n) ),x,0);
    # second Maple program:
    b:= proc(n, i) option remember; `if`(n>i*(i+1)/2, 0,
          `if`(i=0, 1, 2*b(n, i-1)+b(n+i, i-1)+b(abs(n-i), i-1)))
        end:
    a:=n-> b(0, n):
    seq(a(n), n=0..40);  # Alois P. Heinz, Mar 10 2014
  • Mathematica
    b[n_, i_] := b[n, i] = If[n>i*(i+1)/2, 0, If[i == 0, 1, 2*b[n, i-1]+b[n+i, i-1]+b[Abs[n-i], i-1]]]; a[n_] := b[0, n]; Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Mar 10 2014, after Alois P. Heinz *)
    nmax = 26; d = {1}; a1 = {};
    Do[
      i = Ceiling[Length[d]/2];
      AppendTo[a1, If[i > Length[d], 0, d[[i]]]];
      d = PadLeft[d, Length[d] + 2 n] + PadRight[d, Length[d] + 2 n] +
        2 PadLeft[PadRight[d, Length[d] + n], Length[d] + 2 n];
    , {n, nmax}];
    a1 (* Ray Chandler, Mar 15 2014 *)
    Table[Length[Select[Subsets[Range[2n]],Length[#]==0||Mean[#]==n&]],{n,0,6}] (* Gus Wiseman, Apr 18 2023 *)
  • PARI
    a(n)=polcoeff(prod(k=-n,n,1+x^k),0)/2
    
  • PARI
    {a(n)=sum(k=0,n*(n+1)/2,polcoeff(prod(m=1,n,1+x^m+x*O(x^k)),k)^2)} \\ Paul D. Hanna, Nov 30 2010

Formula

Sum of squares of coefficients in Product_{k=1..n} (1+x^k):
a(n) = Sum_{k=0..n(n+1)/2} A053632(n,k)^2. - Paul D. Hanna, Nov 30 2010
a(n) = A000980(n)/2.
a(n) ~ sqrt(3) * 4^n / (sqrt(Pi) * n^(3/2)). - Vaclav Kotesovec, Sep 11 2014
From Gus Wiseman, Apr 18 2023 (Start)
a(n) = A133406(2n+1).
a(n) = A212352(n) + 1.
a(n) = A362046(2n) + 1.
(End)

Extensions

More terms from Michael Somos, Jun 10 2000

A063776 Number of subsets of {1,2,...,n} which sum to 0 modulo n.

Original entry on oeis.org

2, 2, 4, 4, 8, 12, 20, 32, 60, 104, 188, 344, 632, 1172, 2192, 4096, 7712, 14572, 27596, 52432, 99880, 190652, 364724, 699072, 1342184, 2581112, 4971068, 9586984, 18512792, 35791472, 69273668, 134217728, 260301176, 505290272, 981706832
Offset: 1

Views

Author

Ahmed Fares (ahmedfares(AT)my-deja.com), Aug 16 2001

Keywords

Comments

From Gus Wiseman, Sep 14 2019: (Start)
Also the number of subsets of {1..n} that are empty or contain n and have integer mean. If the subsets are not required to contain n, we get A327475. For example, the a(1) = 2 through a(6) = 12 subsets are:
{} {} {} {} {} {}
{1} {2} {3} {4} {5} {6}
{1,3} {2,4} {1,5} {2,6}
{1,2,3} {2,3,4} {3,5} {4,6}
{1,3,5} {1,2,6}
{3,4,5} {1,5,6}
{1,2,4,5} {2,4,6}
{1,2,3,4,5} {4,5,6}
{1,2,3,6}
{1,4,5,6}
{2,3,5,6}
{2,3,4,5,6}
(End)

Examples

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

Crossrefs

Programs

  • Haskell
    a063776 n = a053636 n `div` n  -- Reinhard Zumkeller, Sep 13 2013
    
  • Mathematica
    Table[a = Select[ Divisors[n], OddQ[ # ] &]; Apply[Plus, 2^(n/a)*EulerPhi[a]]/n, {n, 1, 35}]
    a[ n_] := If[ n < 1, 0, 1/n Sum[ Mod[ d, 2] EulerPhi[ d] 2^(n / d), {d, Divisors[ n]}]]; (* Michael Somos, May 09 2013 *)
    Table[Length[Select[Subsets[Range[n]],#=={}||MemberQ[#,n]&&IntegerQ[Mean[#]]&]],{n,0,10}] (* Gus Wiseman, Sep 14 2019 *)
  • PARI
    {a(n) = if( n<1, 0, 1 / n * sumdiv( n, d, (d % 2) * eulerphi(d) * 2^(n / d)))}; /* Michael Somos, May 09 2013 */
    
  • PARI
    a(n) = sumdiv(n, d, (d%2)* 2^(n/d)*eulerphi(d))/n; \\ Michel Marcus, Feb 10 2016
    
  • Python
    from sympy import totient, divisors
    def A063776(n): return (sum(totient(d)<>(~n&n-1).bit_length(),generator=True))<<1)//n # Chai Wah Wu, Feb 21 2023

Formula

a(n) = (1/n) * Sum_{d divides n and d is odd} 2^(n/d) * phi(d).
a(n) = (1/n) * A053636(n). - Michael Somos, May 09 2013
a(n) = 2 * A000016(n).
For odd n, a(n) = A000031(n).
G.f.: -Sum_{m >= 0} (phi(2*m + 1)/(2*m + 1)) * log(1 - 2*x^(2*m + 1)). - Petros Hadjicostas, Jul 13 2019
a(n) = A082550(n) + 1. - Gus Wiseman, Sep 14 2019

Extensions

More terms from Vladeta Jovovic, Aug 20 2001

A231147 Array of coefficients of numerator polynomials of the rational function p(n, x + 1/x), where p(n,x) = (x^n - 1)/(x - 1).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 4, 3, 4, 1, 1, 1, 1, 5, 4, 9, 4, 5, 1, 1, 1, 1, 6, 5, 14, 9, 14, 5, 6, 1, 1, 1, 1, 7, 6, 20, 14, 29, 14, 20, 6, 7, 1, 1, 1, 1, 8, 7, 27, 20, 49, 29, 49, 20, 27, 7, 8, 1, 1, 1, 1, 9, 8, 35, 27, 76, 49, 99, 49, 76, 27, 35, 8, 9
Offset: 1

Views

Author

Clark Kimberling, Nov 05 2013

Keywords

Comments

From Gus Wiseman, Mar 19 2023: (Start)
Also appears to be the number of nonempty subsets of {1,...,n} with median k, where k ranges from 1 to n in steps of 1/2, and the median of a multiset is either the middle part (for odd length), or the average of the two middle parts (for even length). For example, row n = 5 counts the following subsets:
{1} {1,2} {2} {1,4} {3} {2,5} {4} {4,5} {5}
{1,3} {2,3} {1,5} {3,4} {3,5}
{1,2,3} {1,2,3,4} {2,4} {1,3,4,5} {1,4,5}
{1,2,4} {1,2,3,5} {1,3,4} {2,3,4,5} {2,4,5}
{1,2,5} {1,3,5} {3,4,5}
{2,3,4}
{2,3,5}
{1,2,4,5}
{1,2,3,4,5}
Central diagonals T(n,(n+1)/2) appear to be A100066 (bisection A006134).
For mean instead of median we have A327481.
For partitions instead of subsets we have A359893, full steps A359901.
Central diagonals T(n,n/2) are A361801 (bisection A079309).
(End)

Examples

			Triangle begins:
  1
  1  1  1
  1  1  3  1  1
  1  1  4  3  4  1  1
  1  1  5  4  9  4  5  1  1
  1  1  6  5 14  9 14  5  6  1  1
  1  1  7  6 20 14 29 14 20  6  7  1  1
  1  1  8  7 27 20 49 29 49 20 27  7  8  1  1
  1  1  9  8 35 27 76 49 99 49 76 27 35  8  9  1  1
First 3 polynomials: 1, 1 + x + x^2, 1 + x + 3*x^2 + x^3 + x^4
		

Crossrefs

Cf. A231148.
Row sums are 2^n-1 = A000225(n).
Row lengths are 2n-1 = A005408(n-1).
Removing every other column appears to give A013580.

Programs

  • Mathematica
    z = 60; p[n_, x_] := p[x] = (x^n - 1)/(x - 1); Table[p[n, x], {n, 1, z/4}]; f1[n_, x_] := f1[n, x] = Numerator[Factor[p[n, x] /. x -> x + 1/x]]; Table[Expand[f1[n, x]], {n, 0, z/4}]
    Flatten[Table[CoefficientList[f1[n, x], x], {n, 1, z/4}]]
  • PARI
    A231147_row(n) = {Vecrev(Vec(numerator((-1+(x+(1/x))^n)/(x+(1/x)-1))))} \\ John Tyler Rascoe, Sep 10 2024
Showing 1-10 of 29 results. Next