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

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

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

A070925 Number of subsets of A = {1,2,...,n} that have the same center of gravity as A, i.e., (n+1)/2.

Original entry on oeis.org

1, 1, 3, 3, 7, 7, 19, 17, 51, 47, 151, 137, 471, 427, 1519, 1391, 5043, 4651, 17111, 15883, 59007, 55123, 206259, 193723, 729095, 688007, 2601639, 2465133, 9358943, 8899699, 33904323, 32342235, 123580883, 118215779, 452902071, 434314137, 1667837679, 1602935103
Offset: 1

Views

Author

Sharon Sela (sharonsela(AT)hotmail.com), May 20 2002

Keywords

Comments

From Gus Wiseman, Apr 15 2023: (Start)
Also the number of nonempty subsets of {0..n} with mean n/2. The a(0) = 1 through a(5) = 7 subsets are:
{0} {0,1} {1} {0,3} {2} {0,5}
{0,2} {1,2} {0,4} {1,4}
{0,1,2} {0,1,2,3} {1,3} {2,3}
{0,2,4} {0,1,4,5}
{1,2,3} {0,2,3,5}
{0,1,3,4} {1,2,3,4}
{0,1,2,3,4} {0,1,2,3,4,5}
(End)

Examples

			Of the 32 (2^5) sets which can be constructed from the set A = {1,2,3,4,5} only the sets {3}, {2, 3, 4}, {2, 4}, {1, 2, 4, 5}, {1, 2, 3, 4, 5}, {1, 3, 5}, {1, 5} give an average of 3.
		

Crossrefs

The odd bisection is A000980(n) - 1 = 2*A047653(n) - 1.
For median instead of mean we have A100066, bisection A006134.
Including the empty set gives A222955.
The one-based version is A362046, even bisection A047653(n) - 1.
A007318 counts subsets by length.
A067538 counts partitions with integer mean, strict A102627.
A231147 counts subsets by median.
A327481 counts subsets by integer mean.

Programs

  • Mathematica
    Needs["DiscreteMath`Combinatorica`"]; f[n_] := Block[{s = Subsets[n], c = 0, k = 2}, While[k < 2^n + 1, If[ (Plus @@ s[[k]]) / Length[s[[k]]] == (n + 1)/2, c++ ]; k++ ]; c]; Table[ f[n], {n, 1, 20}]
    (* second program *)
    Table[Length[Select[Subsets[Range[0,n]],Mean[#]==n/2&]],{n,0,10}] (* Gus Wiseman, Apr 15 2023 *)

Formula

From Gus Wiseman, Apr 18 2023: (Start)
a(2n+1) = A000980(n) - 1.
a(n) = A222955(n) - 1.
a(n) = 2*A362046(n) + 1.
(End)

Extensions

Edited by Robert G. Wilson v and John W. Layman, May 25 2002
a(34)-a(38) from Fausto A. C. Cariboni, Oct 08 2020

A362046 Number of nonempty subsets of {1..n} with mean n/2.

Original entry on oeis.org

0, 0, 1, 1, 3, 3, 9, 8, 25, 23, 75, 68, 235, 213, 759, 695, 2521, 2325, 8555, 7941, 29503, 27561, 103129, 96861, 364547, 344003, 1300819, 1232566, 4679471, 4449849, 16952161, 16171117, 61790441, 59107889, 226451035, 217157068, 833918839, 801467551, 3084255127
Offset: 0

Views

Author

Gus Wiseman, Apr 12 2023

Keywords

Examples

			The a(2) = 1 through a(7) = 8 subsets:
  {1}  {1,2}  {2}      {1,4}      {3}          {1,6}
              {1,3}    {2,3}      {1,5}        {2,5}
              {1,2,3}  {1,2,3,4}  {2,4}        {3,4}
                                  {1,2,6}      {1,2,4,7}
                                  {1,3,5}      {1,2,5,6}
                                  {2,3,4}      {1,3,4,6}
                                  {1,2,3,6}    {2,3,4,5}
                                  {1,2,4,5}    {1,2,3,4,5,6}
                                  {1,2,3,4,5}
		

Crossrefs

Using range 0..n gives A070925.
Including the empty set gives A133406.
Even bisection is A212352.
For median instead of mean we have A361801, the doubling of A079309.
A version for partitions is A361853, for median A361849.
A000980 counts nonempty subsets of {1..2n-1} with mean n.
A007318 counts subsets by length.
A067538 counts partitions with integer mean, strict A102627.
A231147 appears to count subsets by median, full-steps A013580.
A327475 counts subsets with integer mean, A000975 integer median.
A327481 counts subsets by integer mean.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],Mean[#]==n/2&]],{n,0,15}]

Formula

a(n) = (A070925(n) - 1)/2.
a(n) = A133406(n) - 1.
a(2n) = A212352(n) = A000980(n)/2 - 1.

A212352 Row sums of A047997.

Original entry on oeis.org

0, 1, 3, 9, 25, 75, 235, 759, 2521, 8555, 29503, 103129, 364547, 1300819, 4679471, 16952161, 61790441, 226451035, 833918839, 3084255127, 11451630043, 42669225171, 159497648599, 597950875255, 2247724108771, 8470205600639
Offset: 0

Views

Author

N. J. A. Sloane, May 16 2012

Keywords

Comments

Also the number of nonempty subsets of {1..2n} with mean n, even bisection of A362046. - Gus Wiseman, Apr 15 2023

Examples

			From _Gus Wiseman_, Apr 15 2023: (Start)
The a(1) = 1 through a(3) = 9 subsets:
  {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}
(End)
		

Crossrefs

Equals A047653(n) - 1.
Row sums of A047997.
For median instead of mean we have A079309, bisection of A361801.
Even bisection of A362046, zero-based version A070925.
A000980 counts nonempty subsets of {1..2n-1} with mean n.
A007318 counts subsets by length.
A327475 counts subsets with integer mean.
A327481 counts subsets by mean.

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[2n]],Mean[#]==n&]],{n,0,6}] (* Gus Wiseman, Apr 15 2023 *)

Formula

From Gus Wiseman, Apr 15 2023: (Start)
a(n) = A000980(n)/2 - 1.
a(n) = A047653(n) - 1.
a(n) = A133406(2n+1) - 1.
a(n) = A362046(2n).
(End)

A133413 Half the number of ways of placing up to n^2 pawns on an n x n chessboard so that it balances at its midpoint.

Original entry on oeis.org

1, 2, 24, 492, 202064, 100202536, 888531141152, 8548846756027594, 1400822035743239844640, 241149984205773848119833656, 691305758149247080625180837349904, 2048332087899166877612856148780183708362, 99840603982108483679316058344233421388081447648
Offset: 1

Views

Author

R. H. Hardin, Nov 25 2007

Keywords

Crossrefs

Programs

  • PARI
    a(n) = {polcoef(polcoef(prod(j=1, n, prod(k=1, n, 1 + 'x^(2*k-n-1)*'y^(2*j-n-1) )), 0), 0)/2} \\ Andrew Howroyd, Jan 07 2023

Extensions

a(12)-a(13) from Andrew Howroyd, Jan 07 2023
Showing 1-6 of 6 results.