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

A063865 Number of solutions to +- 1 +- 2 +- 3 +- ... +- n = 0.

Original entry on oeis.org

1, 0, 0, 2, 2, 0, 0, 8, 14, 0, 0, 70, 124, 0, 0, 722, 1314, 0, 0, 8220, 15272, 0, 0, 99820, 187692, 0, 0, 1265204, 2399784, 0, 0, 16547220, 31592878, 0, 0, 221653776, 425363952, 0, 0, 3025553180, 5830034720, 0, 0, 41931984034, 81072032060, 0, 0
Offset: 0

Views

Author

N. J. A. Sloane, suggested by J. H. Conway, Aug 27 2001

Keywords

Comments

Number of sum partitions of the half of the n-th-triangular number by distinct numbers in the range 1 to n. Example: a(7)=8 since triangular(7)=28 and 14 = 2+3+4+5 = 1+3+4+6 = 1+2+5+6 = 3+5+6 = 7+1+2+4 = 7+3+4 = 7+2+5 = 7+1+6. - Hieronymus Fischer, Oct 20 2010
The asymptotic formula below was stated as a conjecture by Andrica & Tomescu in 2002 and proved by B. D. Sullivan in 2013. See his paper and H.-K. Hwang's review MR 2003j:05005 of the JIS paper. - Jonathan Sondow, Nov 11 2013
a(n) is the number of subsets of {1..n} whose sum is equal to the sum of their complement. See example below. - Gus Wiseman, Jul 04 2019

Examples

			From _Gus Wiseman_, Jul 04 2019: (Start)
For example, the a(0) = 1 through a(8) = 14 subsets (empty columns not shown) are:
  {}  {3}    {1,4}  {1,6,7}    {3,7,8}
      {1,2}  {2,3}  {2,5,7}    {4,6,8}
                    {3,4,7}    {5,6,7}
                    {3,5,6}    {1,2,7,8}
                    {1,2,4,7}  {1,3,6,8}
                    {1,2,5,6}  {1,4,5,8}
                    {1,3,4,6}  {1,4,6,7}
                    {2,3,4,5}  {2,3,5,8}
                               {2,3,6,7}
                               {2,4,5,7}
                               {3,4,5,6}
                               {1,2,3,4,8}
                               {1,2,3,5,7}
                               {1,2,4,5,6}
(End)
		

Crossrefs

"Decimations": A060468 = 2*A060005, A123117 = 2*A104456.
Analogous sequences for sums of squares and cubes are A158092, A158118, see also A019568. - Pietro Majer, Mar 15 2009

Programs

  • Maple
    M:=400; t1:=1; lprint(0,1); for n from 1 to M do t1:=expand(t1*(x^n+1/x^n)); lprint(n, coeff(t1,x,0)); od: # N. J. A. Sloane, Jul 07 2008
  • Mathematica
    f[n_, s_] := f[n, s]=Which[n==0, If[s==0, 1, 0], Abs[s]>(n*(n+1))/2, 0, True, f[ n-1, s-n]+f[n-1, s+n]]; a[n_] := f[n, 0]
    nmax = 50; 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];
      , {n, nmax}];
    a1 (* Ray Chandler, Mar 13 2014 *)
  • PARI
    a(n)=my(x='x); polcoeff(prod(k=1,n,x^k+x^-k)+O(x),0) \\ Charles R Greathouse IV, May 18 2015
    
  • PARI
    a(n)=0^n+floor(prod(k=1,n,2^(n*k)+2^(-n*k)))%(2^n) \\ Tani Akinari, Mar 09 2016

Formula

Asymptotic formula: a(n) ~ sqrt(6/Pi)*n^(-3/2)*2^n for n = 0 or 3 (mod 4) as n approaches infinity.
a(n) = 0 unless n == 0 or 3 (mod 4).
a(n) = constant term in expansion of Product_{ k = 1..n } (x^k + 1/x^k). - N. J. A. Sloane, Jul 07 2008
If n = 0 or 3 (mod 4) then a(n) = coefficient of x^(n(n+1)/4) in Product_{k=1..n} (1+x^k). - D. Andrica and I. Tomescu.
a(n) = 2*A058377(n) for any n > 0. - Rémy Sigrist, Oct 11 2017

Extensions

More terms from Dean Hickerson, Aug 28 2001
Corrected and edited by Steven Finch, Feb 01 2009

A069918 Number of ways of partitioning the set {1...n} into two subsets whose sums are as nearly equal as possible.

Original entry on oeis.org

1, 1, 1, 1, 3, 5, 4, 7, 23, 40, 35, 62, 221, 397, 361, 657, 2410, 4441, 4110, 7636, 28460, 53222, 49910, 93846, 353743, 668273, 632602, 1199892, 4559828, 8679280, 8273610, 15796439, 60400688, 115633260, 110826888, 212681976, 817175698, 1571588177, 1512776590
Offset: 1

Views

Author

Robert G. Wilson v, Apr 24 2002

Keywords

Comments

If n mod 4 = 0 or 3, a(n) is the number of solutions to +- 1 +- 2 +- 3 +- ... +- n = 0 or 1; if n mod 4 = 1 or 2, a(n) is half this number.

Examples

			If the triangular number T_n (see A000217) is even then the two totals must be equal, otherwise the two totals differ by one.
a(6) = 5: T6 = 21 and is odd. There are five sets such that the sum of one side is equal to the other side +/- 1. They are 5+6 = 1+2+3+4, 4+6 = 1+2+3+5, 1+4+6 = 2+3+5, 1+3+6 = 2+4+5 and 2+3+6 = 1+4+5.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i) option remember; local m; m:= i*(i+1)/2;
          `if`(n>m, 0, `if`(n=m, 1, b(abs(n-i), i-1) +b(n+i, i-1)))
        end:
    a:= n-> `if`(irem(n-1, 4)<2, b(n-1, n-1) +b(n+1, n-1), b(n, n-1)):
    seq(a(n), n=1..60);  # Alois P. Heinz, Nov 02 2011
  • Mathematica
    Needs["DiscreteMath`Combinatorica`"]; f[n_] := f[n] = Block[{s = Sort[Plus @@@ Subsets[n]], k = n(n + 1)/2}, If[ EvenQ[k], Count[s, k/2]/2, (Count[s, Floor[k/2]] + Count[s, Ceiling[k/2]]) /2]]; Table[ f[n], {n, 1, 22}]
    f[n_, s_] := f[n, s] = Which[n == 0, If[s == 0, 1, 0], Abs[s] > (n*(n + 1))/2, 0, True, f[n - 1, s - n] + f[n - 1, s + n]]; Table[ Which[ Mod[n, 4] == 0 || Mod[n, 4] == 3, f[n, 0]/2, Mod[n, 4] == 1 || Mod[n, 4] == 2, f[n, 1]], {n, 1, 40}]

Formula

If n mod 4 = 0 or 3 then the two subsets have the same sum and a(n) = A025591(n); if n mod 4 = 1 or 2 then the two subsets have sums which differ by 1 and a(n) = A025591(n)/2. - Henry Bottomley, May 08 2002

Extensions

More terms from Henry Bottomley, May 08 2002
Comment corrected by Steven Finch, Feb 01 2009

A007219 Number of golygons of order 8n (or serial isogons of order 8n).

Original entry on oeis.org

1, 28, 2108, 227322, 30276740, 4541771016, 739092675672, 127674038970623, 23085759901610016, 4327973308197103600, 835531767841066680300, 165266721954751746697155, 33364181616540879268092840
Offset: 1

Views

Author

Keywords

Comments

A golygon of order N is a closed path along the streets of the Manhattan grid with successive edge lengths of 1,2,3,...,N (returning to the starting point after the edge of length N), and which makes a 90-degree turn (left or right) after each edge.
It is known that the order N must be a multiple of 8.

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • I. Vardi, Computational Recreations in Mathematica. Addison-Wesley, Redwood City, CA, 1991, p. 92.

Crossrefs

See also A006718.

Programs

  • Mathematica
    p1[n_] := Product[x^k + 1, {k, 1, n - 1, 2}] // Expand; p2[n_] := Product[x^k + 1, {k, 1, n/2}] // Expand; c[n_] := Coefficient[p1[n], x, n^2/8] * Coefficient[p2[n], x, n (n/2 + 1)/8]; a[n_] := c[8*n]/4; Table[a[n], {n, 1, 13}] (* Jean-François Alcover, Jul 24 2013, after Eric W. Weisstein *)

Formula

a(n) = A006718(n)/4. - Charles R Greathouse IV, Apr 29 2012
a(n) ~ 3*2^(8*n-6)/(Pi*n^2*(4*n+1)). - Vaclav Kotesovec, Dec 09 2013

Extensions

Two more terms from N. J. A. Sloane (from the reference), May 23 2005

A060468 Number of fair distributions (equal sum) of the integers {1,..,4n} between A and B = number of solutions to the equation {+-1 +-2 +- 3 ... +-4*n = 0}.

Original entry on oeis.org

1, 2, 14, 124, 1314, 15272, 187692, 2399784, 31592878, 425363952, 5830034720, 81072032060, 1140994231458, 16221323177468, 232615054822964, 3360682669655028, 48870013251334676, 714733339229024336
Offset: 0

Views

Author

Roland Bacher, Mar 15 2001

Keywords

Examples

			a(1)=2: give either the set {1,4} to A and {2,3} to B or give {2,3} to A and {1,4} to B.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Coefficient[Product[q^(-k) + q^k, {k, 1, 4*n}], q, 0]; Table[a[n], {n, 0, 17}] (* Jean-François Alcover, Sep 26 2013 *)

Formula

a(n) = coefficient of q^0 in Product_{k=1..4*n} (q^(-k) + q^k).
a(n) = A025591(4n) = A063865(4n) = A063867(4n) = 2*A060005(n). Seems to be close to sqrt(3/32Pi)*16^n/sqrt(n^3 + n^2*0.6 + n*0.1385...) and sqrt(n*Pi/2)*A063074(n). - Henry Bottomley, Jul 30 2005

A104456 Number of ways of partitioning the integers {1,2,..,4n-1} into two unordered sets such that the sums of parts are equal in both sets (parts in one of the sets hence sum up to n*(4n-1)). Number of solutions to {1 +- 2 +- 3+ ... +- 4n-1 = 0}.

Original entry on oeis.org

1, 4, 35, 361, 4110, 49910, 632602, 8273610, 110826888, 1512776590, 20965992017, 294245741167, 4173319332859, 59723919552183, 861331863890066, 12505857230438737, 182650875111521033, 2681644149792639400, 39555354718945873299, 585903163431438401072
Offset: 1

Views

Author

Yiu Tung Poon (ytpoon(AT)iastate.edu) and Chun Chor Litwin Cheng (cccheng(AT)ied.edu.hk), Mar 08 2005

Keywords

Examples

			a(2) = 4 since there are 4 ways of partitioning {1,2,3,4,5,6,7} into two sets of equal sum, namely {{1,2,5,6}, {3,4,7}}, {{1,3,4,6}, {2,5,7}}, {{2,3,4,5}, {1,6,7}}, {{1,2,4,7}, {3,5,6}}.
G.f. = x + 4*x^2 + 35*x^3 + 361*x^4 + 4110*x^5 + 49910*x^6 + ...
		

Crossrefs

Cf. A060005.

Programs

  • Maple
    b:= proc(n, i) option remember; local m; m:= i*(i+1)/2;
          `if`(n>m, 0, `if`(n=m, 1, b(abs(n-i), i-1) +b(n+i, i-1)))
        end:
    a:= n-> b(4*n-1, 4*n-2):
    seq(a(n), n=1..30); # Alois P. Heinz, Nov 01 2011
  • Mathematica
    Table[CoefficientList[Product[1 + x^j, {j, 1, 4n - 1}], x][[n*(4n - 1) + 1]]/2, {n, 20}]

Formula

a(n) = A058377(4n-1). - N. J. A. Sloane, Jan 24 2006
a(n) is half the coefficient of q^(n*(4n - 1)) in the product('1 + x^j', 'j'=1..4*n-1), for n >= 1. - N. J. A. Sloane, Feb 24 2006
a(n) = (1/Pi)*2^(4n-1)*J(4n-1) where J(n) = integral(t=0, Pi/2, cos(t) * cos(2t) * ... * cos(nt)dt), n>=1. - Benoit Cloitre, Sep 24 2006
a(n) = A123117(n)/2. - N. J. A. Sloane, Jan 09 2009

A107350 Number of isogons with a certain property.

Original entry on oeis.org

1, 4, 34, 346, 3965, 48396, 615966, 8082457, 108545916, 1484716135, 20612084010, 289688970195, 4113620233260, 58930127470164, 850641610106596, 12360278974175769, 180648953113093368, 2653875476976308643, 39167191622334514398, 580439539153823110678, 8633956582855204662785
Offset: 1

Views

Author

N. J. A. Sloane, May 23 2005

Keywords

Comments

This and A060005 appear in the reference as incidental sequences when computing A007219.

Crossrefs

Programs

  • Maple
    A107350 := proc(n) res := 1 ; for i from 0 to 4*n-1 do res := taylor(res*(1+x^(2*i+1)),x=0,8*n^2+1) ; od ; coeftayl(res,x=0,8*n^2)/2 ; end: for n from 1 to 25 do printf("%d, ",A107350(n)) ; od ; # R. J. Mathar, May 08 2007
  • Mathematica
    a[n_] := SeriesCoefficient[Product[x^(2k - 1) + 1/x^(2k - 1), {k, 1, 4n}], {x, 0, 0}]/2;
    Table[a[n], {n, 1, 25}] (* Jean-François Alcover, Mar 10 2023 *)

Formula

product[ {1+x^(2i+1)},i=0,1,...,4n-1] = 1+...+2*a(n)*x^(8n^2)+.... (g.f.). - R. J. Mathar, May 08 2007
a(n) = A292476(2*n)/2. - Seiichi Manyama, Sep 18 2017

Extensions

More terms from R. J. Mathar, May 08 2007

A227850 Number of Dyck paths of semilength n*(4*n+1) in which the run length sequence is a permutation of {1,...,4*n}.

Original entry on oeis.org

1, 4, 1248, 5401472, 114070692352, 7593330670240768
Offset: 0

Views

Author

David Scambler and Alois P. Heinz, Oct 31 2013

Keywords

Examples

			a(1) = 4: UUDUUUDDDD (2134), UUUDUUDDDD (3124), UUUUDDUDDD (4213), UUUUDDDUDD (4312).
		

Crossrefs

Programs

  • Maple
    h:= proc(n, s) option remember;
           `if`(n>add(sort([s[]], `>`)[i], i=1..(nops(s)+1)/2), 0,
           add(g(n-i, s minus {i}), i=select(x-> x<=n, s)))
        end:
    g:= proc(n, s) option remember;
           `if`(s={}, `if`(n=0, 1, 0), add(h(n+i, s minus {i}), i=s))
        end:
    a:= n-> g(0, {$1..4*n}):
    seq(a(n), n=0..3);
  • Mathematica
    h[n_, s_] := h[n, s] = If[n > Sum[Sort[s, Greater][[i]], {i, 1, (Length[s] + 1)/2}], 0, Sum[g[n - i, s ~Complement~ {i}], {i, Select[s, # <= n&]}] ];
    g[n_, s_] := g[n, s] = If[s == {}, If[n == 0, 1, 0], Sum[h[n + i, s  ~Complement~ {i}], {i, s}]];
    a[n_] := g[0, Range[4*n]];
    Table[a[n], {n, 0, 4}] (* Jean-François Alcover, Apr 23 2016, translated from Maple *)

A167385 a(n)= sum_{i=7..n+6} A000931(i).

Original entry on oeis.org

1, 3, 5, 8, 12, 17, 24, 33, 45, 61, 82, 110, 147, 196, 261, 347, 461, 612, 812, 1077, 1428, 1893, 2509, 3325, 4406, 5838, 7735, 10248, 13577, 17987, 23829, 31568, 41820, 55401, 73392, 97225, 128797, 170621, 226026, 299422, 396651, 525452, 696077, 922107, 1221533
Offset: 0

Views

Author

Roger L. Bagula, Nov 02 2009

Keywords

Crossrefs

Cf. A018917.

Programs

  • Mathematica
    Clear[f, g, n]
    f[0] = 0; f[1] = 1; f[2] = 1; f[n_] := f[n] = f[n - 2] + f[n - 3];
    g[n_] := Sum[f[i + 3], {i, 0, n}]
    Table[g[n], {n, 0, 30}]

Formula

a(n+1)/a(n)-> A060005 as n->infinity.
G.f.: (1+x)^2/((x-1)*(x^3+x^2-1)). a(n)= +a(n-1) +a(n-2) -a(n-4). [Nov 05 2009]
a(n) = A000931(n+12)-4. [Nov 05 2009]

Extensions

Notation normalized, definition corrected, g.f. added - The Assoc. Editors of the OEIS, Nov 05 2009
Showing 1-8 of 8 results.