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

A124624 Erroneous version of A058377.

Original entry on oeis.org

1, 1, 4, 7, 35, 62, 361, 657, 4110, 7636, 49910, 93846, 632602, 1199892, 8273610
Offset: 1

Views

Author

Keywords

A111133 Number of partitions of n into at least two distinct parts.

Original entry on oeis.org

0, 0, 0, 1, 1, 2, 3, 4, 5, 7, 9, 11, 14, 17, 21, 26, 31, 37, 45, 53, 63, 75, 88, 103, 121, 141, 164, 191, 221, 255, 295, 339, 389, 447, 511, 584, 667, 759, 863, 981, 1112, 1259, 1425, 1609, 1815, 2047, 2303, 2589, 2909, 3263, 3657, 4096, 4581, 5119, 5717, 6377
Offset: 0

Views

Author

David Sharp (davidsharp(AT)rcn.com), Oct 17 2005

Keywords

Comments

Old name: Number of sets of natural numbers less than n which sum to n.
From Clark Kimberling, Mar 13 2012: (Start)
(1) Number of partitions of n into at least two distinct parts.
(2) Also, number of partitions of 2n into distinct parts having maximal part n; see Example section. (End)

Examples

			a(6) = 3 because 1+5, 2+4 and 1+2+3 each sum to 6. That is, the three sets are {1,5},{2,4},{1,2,3}.
For n=6, the partitions of 2n into distinct parts having maximum 6 are 6+5+1, 6+4+2, 6+3+2+1, so that a(6)=3, as an example for Comment (2). - _Clark Kimberling_, Mar 13 2012
		

Crossrefs

Cf. A058377.
Cf. A000009.

Programs

  • Haskell
    a111133 = subtract 1 . a000009  -- Reinhard Zumkeller, Sep 09 2015
  • Maple
    seq(coeff(series(mul((1+x^k),k=1..n)-1/(1-x), x,n+1),x,n),n=0..60); # Muniru A Asiru, Aug 10 2018
  • Mathematica
    Needs["DiscreteMath`Combinatorica`"]
    f[n_] := Block[{lmt = Floor[(Sqrt[8n + 1] - 1)/2] + 1, t}, Sum[ Length[ Select[Plus @@@ KSubsets[ Range[n - k(k - 1)/2 + 1], k], # == n &]], {k, 2, lmt}]]; Array[f, 55] (* Robert G. Wilson v, Oct 17 2005 *)
    (* Next program shows the partitions (sets) *)
    d[n_] := Select[IntegerPartitions[n], Max[Length /@ Split@ #] == 1 &]; Table[d[n], {n, 1, 12}]
    TableForm[%]
    (* Clark Kimberling, Mar 13 2012 *)
    Table[PartitionsQ[n]-1, {n, 0, 55}] (* Jean-François Alcover, Jan 17 2014, after Vladeta Jovovic *)
  • PARI
    N=66;  x='x+O('x^N);
    gf=sum(k=0,N, x^((k^2+k)/2) / prod(j=1,k, 1-x^j)) - 1/(1-x);
    concat( [0,0,0], Vec(gf) ) /* Joerg Arndt, Sep 17 2012 */
    

Formula

a(n) = A000009(n) - 1. - Vladeta Jovovic, Oct 19 2005
G.f.: Sum_{k>=0} (x^((k^2+k)/2) / Product_{j=1..k} (1-x^j)) - 1/(1-x). - Joerg Arndt, Sep 17 2012
a(n) = A026906(floor(n-1)/2) + A258259(n). - Bob Selcoe, Oct 05 2015
G.f.: -1/(1 - x) + Product_{k>=1} (1 + x^k). - Ilya Gutkovskiy, Aug 10 2018
G.f.: Sum_{n >= 1} x^(2*n+1)/Product_{k = 1..n+1} 1 - x^(2*k-1). - Peter Bala, Nov 20 2024

Extensions

More terms from Vladeta Jovovic and Robert G. Wilson v, Oct 17 2005
a(0)=0 prepended by Joerg Arndt, Sep 17 2012

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

A083206 a(n) is the number of ways of partitioning the divisors of n into two disjoint sets with equal sum.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 17, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 3, 0, 0, 0, 14, 0, 0, 0, 1, 0, 13, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 2, 0, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 22 2003

Keywords

Comments

a(n)=0 for deficient numbers n (A005100), but the converse is not true, as 18 is abundant (A005101) and a(18)=0, see A083211;
a(n)=1 for perfect numbers n (A000396), see A083209 for all numbers with a(n)=1;
records: A083213(k)=a(A083212(k)).
In order that a(n)>0, the sum of divisors of n must be even by definition: a(n) = half the number of partitions of A000203(n)/2 into divisors of n, see formula. [Reinhard Zumkeller, Jul 10 2010]

Examples

			a(24)=3: 1+2+3+4+8+12=6+24, 1+3+6+8+12=2+4+24, 4+6+8+12=1+2+3+24.
		

Crossrefs

Cf. A083208 [= a(A083207(n))], A083211, A000005, A000203, A082729, A378446 (inverse Möbius transform), A378449.
Cf. A083207 (positions of terms > 0), A083210 (positions of 0's), A083209 (positions of 1's), A378652 (of 2's).

Programs

  • Mathematica
    a[n_] := (s = DivisorSigma[1, n]; If[Mod[s, 2] == 1, 0, f[n, s/2, 2]]); f[n_, m_, k_] := f[n, m, k] = If[k <= m, f[n, m, k+1] + f[n, m-k, k+1]*Boole[Mod[n, k] == 0], Boole[m == 0]]; Array[a, 105] (* Jean-François Alcover, Jul 29 2015, after Reinhard Zumkeller *)
  • PARI
    A083206(n) = { my(s=sigma(n),p=1); if(s%2 || s < 2*n, 0, fordiv(n, d, p *= ('x^d + 'x^-d)); (polcoeff(p, 0)/2)); }; \\ Antti Karttunen, Dec 02 2024, after Ilya Gutkovskiy

Formula

a(n) = if sigma(n) mod 2 = 1 then 0 else f(n,sigma(n)/2,2), where sigma=A000203 and f(n,m,k) = if k<=m then f(n,m,k+1)+f(n,m-k,k+1)*0^(n mod k) else 0^m, cf. A033630, also using f. [Reinhard Zumkeller, Jul 10 2010]
a(n) is half the coefficient of x^0 in Product_{d|n} (x^d + 1/x^d). - Ilya Gutkovskiy, Feb 04 2024

A103977 Zumkeller deficiency of n: Let d_1 ... d_k be the divisors of n. Then a(n) = min_{ e_1 = +-1, ... e_k = +-1 } | Sum_i e_i d_i |.

Original entry on oeis.org

1, 1, 2, 1, 4, 0, 6, 1, 5, 2, 10, 0, 12, 4, 6, 1, 16, 1, 18, 0, 10, 8, 22, 0, 19, 10, 14, 0, 28, 0, 30, 1, 18, 14, 22, 1, 36, 16, 22, 0, 40, 0, 42, 4, 12, 20, 46, 0, 41, 7, 30, 6, 52, 0, 38, 0, 34, 26, 58, 0, 60, 28, 22, 1, 46, 0, 66, 10, 42, 0, 70, 1, 72, 34, 26, 12, 58, 0, 78, 0
Offset: 1

Views

Author

Yasutoshi Kohmoto, Jan 01 2007

Keywords

Comments

Like the ordinary deficiency (A033879) obtains 0's only at perfect numbers (A000396), the Zumkeller deficiency obtains 0's only at integer-perfect numbers, A083207. See the formula section. Unlike the ordinary deficiency, this obtains only nonnegative values. See A378600 for another version. - Antti Karttunen, Dec 03 2024

Examples

			a(6) = 1 + 2 + 3 - 6 = 0.
		

Crossrefs

Cf. A125732, A125733, A005835, A023196, A033879, A083206, A083207 (positions of 0's), A263837, A378643 (Dirichlet inverse), A378644 (Möbius transform), A378645, A378646, A378647 (an analog of A000027), A378648 (an analog of sigma), A378649 (an analog of Euler phi), A379503 (positions of 1's), A379504, A379505.
Cf. A378600 (signed variant).
Cf. also A058377, A119347.

Programs

  • Maple
    A103977 := proc(n) local divs,a,acandid,filt,i,p,sigs ; divs := convert(numtheory[divisors](n),list) ; a := add(i,i=divs) ; for sigs from 0 to 2^nops(divs)-1 do filt := convert(sigs,base,2) ; while nops(filt) < nops(divs) do filt := [op(filt), 0] ; od ; acandid := 0 ; for p from 0 to nops(divs)-1 do if op(p+1,filt) = 0 then acandid := acandid-op(p+1,divs) ; else acandid := acandid+op(p+1,divs) ; fi ; od: acandid := abs(acandid) ; if acandid < a then a := acandid ; fi ; od: RETURN(a) ; end: seq(A103977(n),n=1..80) ; # R. J. Mathar, Nov 27 2007
    # second Maple program:
    a:= proc(n) option remember; local l, b; l, b:= [numtheory[divisors](n)[]],
          proc(s, i) option remember; `if`(i<1, s,
            min(b(s+l[i], i-1), b(abs(s-l[i]), i-1)))
          end: b(0, nops(l))
        end:
    seq(a(n), n=1..80);  # Alois P. Heinz, Dec 05 2024
  • Mathematica
    a[n_] := Module[{d = Divisors[n], c, p, m}, c = CoefficientList[Product[1 + x^i, {i, d}], x]; p = -1 + Position[c, ?(# > 0 &)] // Flatten; m = Length[p]; If[OddQ[m], If[(d = p[[(m + 1)/2]] - p[[(m - 1)/2]]) == 1, 0, d], p[[m/2 + 1]] - p[[m/2]]]]; Array[a, 100] (* _Amiram Eldar, Dec 11 2019 *)
  • PARI
    nonzerocoefpositions(p) = { my(v=Vec(p), lista=List([])); for(i=1,#v,if(v[i], listput(lista,i))); Vec(lista); }; \\ Doesn't need to be 0-based, as we use their differences only.
    A103977(n) = { my(p=1); fordiv(n, d, p *= (1 + 'x^d)); my(plist=nonzerocoefpositions(p), m = #plist, d); if(!(m%2), plist[1+(m/2)]-plist[m/2], d = plist[(m+1)/2]-plist[(m-1)/2]; if(1==d,0,d)); }; \\ Antti Karttunen, Dec 03 2024, after Mathematica-program by Amiram Eldar

Formula

If n=p (prime), then a(n)=p-1. If n=2^m, then a(n)=1. [Corrected by R. J. Mathar, Nov 27 2007]
a(n) = 0 iff n is a Zumkeller number (A083207). - Amiram Eldar, Jan 05 2020
From Antti Karttunen, Dec 03 2024: (Start)
a(n) = A033879(n) iff n is a non-abundant number (A263837).
a(n) = abs(A378600(n)).
a(n) = 2*A378647(n) - A378648(n). [Analogously to A033879(n) = 2*n - sigma(n)]
a(n) = 0 <=> A083206(n) > 0.
(End)
a(p^e) = p^e - (1+p+...+p^(e-1)) = (p^e*(p-2) + 1)/(p-1) for prime p. - Jianing Song, Dec 05 2024
a(n) = 1 <=> A379504(n) > 0. - Antti Karttunen, Jan 07 2025

Extensions

More terms from R. J. Mathar, Nov 27 2007
Name "Zumkeller deficiency" coined by Antti Karttunen, Dec 03 2024

A275714 Number T(n,k) of set partitions of [n] into k blocks with equal element sum; triangle T(n,k), n>=0, 0<=k<=ceiling(n/2), read by rows.

Original entry on oeis.org

1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 4, 0, 1, 0, 1, 7, 3, 1, 0, 1, 0, 9, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 35, 43, 0, 0, 1, 0, 1, 62, 102, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 595, 0, 68, 0, 1, 0, 1, 361, 1480, 871, 187, 17, 0, 1
Offset: 0

Views

Author

Alois P. Heinz, Aug 06 2016

Keywords

Examples

			T(8,1) = 1: 12345678.
T(8,2) = 7: 12348|567, 12357|468, 12456|378, 1278|3456, 1368|2457, 1458|2367, 1467|2358.
T(8,3) = 3: 1236|48|57, 138|246|57, 156|237|48.
T(8,4) = 1: 18|27|36|45.
T(9,3) = 9: 12345|69|78, 1239|456|78, 1248|357|69, 1257|348|69, 1347|258|69, 1356|249|78, 159|2346|78, 168|249|357, 159|267|348.
Triangle T(n,k) begins:
00 :  1;
01 :  0,  1;
02 :  0,  1;
03 :  0,  1,   1;
04 :  0,  1,   1;
05 :  0,  1,   0,    1;
06 :  0,  1,   0,    1;
07 :  0,  1,   4,    0,   1;
08 :  0,  1,   7,    3,   1;
09 :  0,  1,   0,    9,   0,   1;
10 :  0,  1,   0,    0,   0,   1;
11 :  0,  1,  35,   43,   0,   0,  1;
12 :  0,  1,  62,  102,   0,   0,  1;
13 :  0,  1,   0,    0,   0,   0,  0, 1;
14 :  0,  1,   0,  595,   0,  68,  0, 1;
15 :  0,  1, 361, 1480, 871, 187, 17, 0, 1;
		

Crossrefs

Columns k=0-5 give: A000007, A000012 (for n>0), A058377, A112972, A317806, A317807.
Row sums give A035470 = 1 + A112956.
T(n^2,n) gives A321282.
Cf. A248112.

Programs

  • Mathematica
    Needs["Combinatorica`"]; T[n_, k_] := Count[(Equal @@ (Total /@ #)&) /@ KSetPartitions[n, k], True]; Table[row = Table[T[n, k], {k, 0, Ceiling[n/2]}]; Print[n, " ", row]; row, {n, 0, 12}] // Flatten (* Jean-François Alcover, Jan 20 2017 *)

A059529 For 1 < x, each c(i) is "multiply" (*) or "divide" (/); a(n) is number of choices for c(0),...,c(n-1) so that 1 c(0) x^1 c(1) x^2,.., c(n-1) x^n is an integer.

Original entry on oeis.org

1, 1, 2, 5, 9, 16, 32, 68, 135, 256, 512, 1059, 2110, 4096, 8192, 16745, 33425, 65536, 131072, 266254, 531924, 1048576, 2097152, 4244214, 8482454, 16777216, 33554432, 67741466, 135417620, 268435456, 536870912, 1082015434, 2163280087, 4294967296, 8589934592
Offset: 0

Views

Author

Naohiro Nomoto, Feb 16 2001

Keywords

Comments

From Gus Wiseman, Jul 04 2019: (Start)
Also the number of subsets of {1..n} whose sum is less than or equal to the sum of their complement. For example, the a(0) = 1 through a(5) = 16 subsets are:
{} {} {} {} {} {}
{1} {1} {1} {1}
{2} {2} {2}
{3} {3} {3}
{1,2} {4} {4}
{1,2} {5}
{1,3} {1,2}
{1,4} {1,3}
{2,3} {1,4}
{1,5}
{2,3}
{2,4}
{2,5}
{3,4}
{1,2,3}
{1,2,4}
(End)

Examples

			x = 3: for n = 2 there are 2 possibilities: 1*3*9=27 and 1/3*9=3. For n = 4 there are 9 possibilities: 1*3*9*27*81 1/3*9*27*81 1*3/9*27*81 1/3/9*27*81 1*3*9/27*81 1*3*9*27/81 1/3*9/27*81 1/3*9*27/81 1*3/9/27*81
		

Crossrefs

Programs

  • Mathematica
    Table[Length[Select[Subsets[Range[n]],Plus@@Complement[Range[n],#]>=Plus@@#&]],{n,0,10}] (* Gus Wiseman, Jul 04 2019 *)

Formula

a(0)=1; for 0A058377(n)+2^(n-1).

Extensions

More terms from Alois P. Heinz, Jun 13 2019

A060005 Number of ways of partitioning the integers {1,2,..,4n} into two (unordered) sets such that the sums of parts are equal in both sets (parts in either set will add up to (4n)*(4n+1)/4). Number of solutions to {1 +- 2 +- 3 +- ... +- 4n=0}.

Original entry on oeis.org

1, 1, 7, 62, 657, 7636, 93846, 1199892, 15796439, 212681976, 2915017360, 40536016030, 570497115729, 8110661588734, 116307527411482, 1680341334827514, 24435006625667338, 357366669614512168, 5253165510907071170
Offset: 0

Views

Author

Roland Bacher, Mar 15 2001

Keywords

Examples

			a(1)=1 since there is only one way of partitioning {1,2,3,4} into two sets of equal sum, namely {1,4}, {2,3}.
		

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-> b(4*n, 4*n-1):
    seq(a(n), n=0..30);  # Alois P. Heinz, Oct 30 2011
  • Mathematica
    b[n_, i_] := b[n, i] = Module[{m = i*(i+1)/2}, If[n > m, 0, If[n == m, 1, b[Abs[n-i], i-1] + b[n+i, i-1]]]]; a[n_] := b[4*n, 4*n-1]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Sep 26 2013, translated from Alois P. Heinz's Maple program *)

Formula

a(0)=1 and a(n) is half the coefficient of q^0 in product((q^(-k)+q^k), k=1..4*n) for n >= 1.
For n>=1, a(n) = (1/Pi)*16^n*J(4n) where J(n) = integral(t=0, Pi/2, cos(t)cos(2t)...cos(nt)dt). - Benoit Cloitre, Sep 24 2006

Extensions

More terms from Alois P. Heinz, Oct 30 2011

A112972 Number of ways the set {1,2,...,n} can be split into three subsets of equal sums.

Original entry on oeis.org

0, 0, 0, 0, 1, 1, 0, 3, 9, 0, 43, 102, 0, 595, 1480, 0, 9294, 23728, 0, 157991, 411474, 0, 2849968, 7562583, 0, 53987864, 145173095, 0, 1061533318, 2885383960, 0, 21515805520, 59003023409, 0, 447142442841, 1235311936936, 0, 9489835046489, 26382363207307
Offset: 1

Views

Author

Floor van Lamoen, Oct 07 2005

Keywords

Examples

			For n=8 we have 84/75/6321, 84/732/651 and 831/75/642 so a(8)=3.
		

Crossrefs

Column k=3 of A275714.
Similar sequences: A327448, A327449, A327450.

Programs

  • Maple
    A112972:= n-> coeff(coeff(mul((x^(-2*k)+x^k*(y^k+y^(-k)))
                  , k=1..n), x, 0), y, 0)/6:
    seq(A112972(n), n=1..20);
    # second Maple program:
    b:= proc() option remember; local i, j, t; `if`(args[1]=0,
          `if`(nargs=2, 1, b(args[t] $t=2..nargs)), add(
          `if`(args[j] -args[nargs]<0, 0, b(sort([seq(args[i]-
          `if`(i=j, args[nargs], 0), i=1..nargs-1)])[],
                    args[nargs]-1)), j=1..nargs-1))
        end:
    a:= n-> (m-> `if`(irem(m, 3)=0, b((m/3)$3, n)/6, 0))(n*(n+1)/2):
    seq(a(n), n=1..42);  # Alois P. Heinz, Sep 03 2009
  • Mathematica
    b[args_List] := b[args] = Module[{nargs = Length[args]}, If[args[[1]] == 0, If[nargs == 2, 1, b[args // Rest]], Sum[If[args[[j]] - Last[args] < 0, 0, b[Append[Sort[Flatten[Table[args[[i]] - If[i == j, Last[args], 0], {i, 1, nargs-1}]]], Last[args]-1]]], {j, 1, nargs-1}]]];
    a[n_] := If[Mod[#, 3] == 0, b[{#/3, #/3, #/3, n}]/6, 0]&[n(n+1)/2];
    Array[a, 42] (* Jean-François Alcover, Oct 30 2020, after Alois P. Heinz *)

Formula

a(n) is 1/6 of the coefficient of x^0*y^0 in Product_{k=1..n} (x^(-2*k)+x^k*(y^k+y^(-k))).

Extensions

Extended beyond a(25) by Alois P. Heinz, Sep 03 2009

A300190 Number of solutions to 1 +- 2 +- 3 +- ... +- n == 0 (mod n).

Original entry on oeis.org

1, 0, 2, 4, 4, 0, 10, 32, 30, 0, 94, 344, 316, 0, 1096, 4096, 3856, 0, 13798, 52432, 49940, 0, 182362, 699072, 671092, 0, 2485534, 9586984, 9256396, 0, 34636834, 134217728, 130150588, 0, 490853416, 1908874584, 1857283156, 0, 7048151672, 27487790720
Offset: 1

Views

Author

Seiichi Manyama, Feb 28 2018

Keywords

Comments

Apparently a(2*n + 1) = A053656(2*n + 1) for n >= 0. - Georg Fischer, Mar 26 2019

Examples

			Solutions for n = 7:
--------------------------
1 +2 +3 +4 +5 +6 +7 =  28.
1 +2 +3 +4 +5 +6 -7 =  14.
1 +2 -3 +4 -5 -6 +7 =   0.
1 +2 -3 +4 -5 -6 -7 = -14.
1 +2 -3 -4 +5 +6 +7 =  14.
1 +2 -3 -4 +5 +6 -7 =   0.
1 -2 +3 +4 -5 +6 +7 =  14.
1 -2 +3 +4 -5 +6 -7 =   0.
1 -2 -3 -4 -5 +6 +7 =   0.
1 -2 -3 -4 -5 +6 -7 = -14.
		

Crossrefs

Number of solutions to 1 +- 2^k +- 3^k +- ... +- n^k == 0 (mod n): this sequence (k=1), A300268 (k=2), A300269 (k=3).
Cf. A016825 (4n+2).

Programs

  • Maple
    b:= proc(n, i, m) option remember; `if`(i=0, `if`(n=0, 1, 0),
          add(b(irem(n+j, m), i-1, m), j=[i, m-i]))
        end:
    a:= n-> b(0, n-1, n):
    seq(a(n), n=1..60);  # Alois P. Heinz, Mar 01 2018
  • Mathematica
    b[n_, i_, m_] := b[n, i, m] = If[i == 0, If[n == 0, 1, 0], Sum[b[Mod[n + j, m], i - 1, m], {j, {i, m - i}}]];
    a[n_] := b[0, n - 1, n];
    Array[a, 60] (* Jean-François Alcover, Apr 29 2020, after Alois P. Heinz *)
  • Ruby
    def A(n)
      ary = [1] + Array.new(n - 1, 0)
      (1..n).each{|i|
        i1 = 2 * i
        a = ary.clone
        (0..n - 1).each{|j| a[(j + i1) % n] += ary[j]}
        ary = a
      }
      ary[(n * (n + 1) / 2) % n] / 2
    end
    def A300190(n)
      (1..n).map{|i| A(i)}
    end
    p A300190(100)

Formula

a(4*n+1) = A000016(n), a(4*n+2) = 0, a(4*n+3) = A000016(n), a(4*n+4) = 2 * A000016(n) for n > 0.
a(2^n) = 2^A000325(n) for n > 1.
Showing 1-10 of 23 results. Next