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

A035470 Number of ways to break {1,2,3,...,n} into sets with equal sums.

Original entry on oeis.org

1, 1, 2, 2, 2, 2, 6, 12, 11, 2, 80, 166, 2, 665, 2918, 3309, 9296, 23730, 31875, 301030, 422897, 2, 13716867, 71504980, 100664385, 54148591, 880696662, 498017759, 27450476787, 111911522819, 179459955554, 2144502175214, 59115423983, 45837019664552, 375743493787258, 816118711787493, 2, 9492169507922
Offset: 1

Views

Author

Keywords

Comments

a(n) = 2 <=> |{d|n*(n+1)/2 : d>=n}| = 2. - Alois P. Heinz, Sep 03 2009

Examples

			a(7) = 6 since we have 1234567, 16/25/34/7, 167/2345, 257/1346, 347/1256, 356/1247.
From _Gus Wiseman_, Jul 13 2019: (Start)
The a(6) = 2 through a(9) = 11 set partitions with equal block-sums:
  {123456}      {1234567}        {12345678}        {123456789}
  {16}{25}{34}  {1247}{356}      {12348}{567}      {12345}{69}{78}
                {1256}{347}      {12357}{468}      {1239}{456}{78}
                {1346}{257}      {12456}{378}      {1248}{357}{69}
                {167}{2345}      {1278}{3456}      {1257}{348}{69}
                {16}{25}{34}{7}  {1368}{2457}      {1347}{258}{69}
                                 {1458}{2367}      {1356}{249}{78}
                                 {1467}{2358}      {159}{2346}{78}
                                 {1236}{48}{57}    {159}{267}{348}
                                 {138}{246}{57}    {168}{249}{357}
                                 {156}{237}{48}    {18}{27}{36}{45}{9}
                                 {18}{27}{36}{45}
(End)
		

Crossrefs

Programs

  • Maple
    with(numtheory): 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:= proc(n) local i, m, x; m:= n*(n+1)/2; 1+ add(b(i$(m/i), n)/(m/i)!, i=[select(x-> x>=n, divisors(m) minus {m})[]]) end: seq(a(n), n=1..25);  # Alois P. Heinz, Sep 03 2009
  • Mathematica
    b[args_List] := b[args] = If[args[[1]] == 0, If[Length[args] == 2, 1, b[Rest[args]]], Sum[If[args[[j]] - args[[-1]] < 0, 0, b[Sort[Join[Table[ args[[i]] - If[i == j, args[[-1]], 0], {i, 1, Length[args]-1}]]], {args[[-1]]-1}]], {j, 1, Length[args]-1}]]; b[a1_List, a2_List] := b[Join[a1, a2]];
    a[n_] := a[n] = With[{m = n*(n+1)/2}, 1+Sum[b[Append[Array[i&, m/i], n]] / (m/i)!, {i, Select[Divisors[m] ~Complement~ {m}, # >= n &]}]];
    Table[Print["a(", n, ") = ", a[n]]; a[n], {n, 1, 25}] (* Jean-François Alcover, Mar 22 2017, after Alois P. Heinz *)
    sps[{}]:={{}};sps[set:{i_,_}]:=Join@@Function[s,Prepend[#,s]&/@sps[Complement[set,s]]]/@Cases[Subsets[set],{i,_}];
    Table[Length[Select[sps[Range[n]],SameQ@@Total/@#&]],{n,0,10}] (* Gus Wiseman, Jul 13 2019 *)

Extensions

More terms from John W. Layman, Mar 18 2002
a(19)-a(33) from Alois P. Heinz, Sep 03 2009
a(34) from Alois P. Heinz, May 24 2015
a(35)-a(38) from Max Alekseyev, Feb 15 2024

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

Original entry on oeis.org

0, 0, 1, 1, 0, 0, 4, 7, 0, 0, 35, 62, 0, 0, 361, 657, 0, 0, 4110, 7636, 0, 0, 49910, 93846, 0, 0, 632602, 1199892, 0, 0, 8273610, 15796439, 0, 0, 110826888, 212681976, 0, 0, 1512776590, 2915017360, 0, 0, 20965992017, 40536016030, 0, 0, 294245741167
Offset: 1

Views

Author

Naohiro Nomoto, Dec 19 2000

Keywords

Comments

Consider the set { 1,2,3,...,n }. Sequence gives number of ways this set can be partitioned into 2 subsets with equal sums. For example, when n = 7, { 1,2,3,4,5,6,7} can be partitioned in 4 ways: {1,6,7} {2,3,4,5}; {2,5,7} {1,3,4,6}; {3,4,7} {1,2,5,6} and {1,2,4,7} {3,5,6}. - sorin (yamba_ro(AT)yahoo.com), Mar 24 2007
The "equal sums" of Sorin's comment are the positive terms of A074378 (Even triangular numbers halved). In the current sequence a(n) <> 0 iff n is the positive index (A014601) of an even triangular number (A014494). - Rick L. Shepherd, Feb 09 2010
a(n) is the number of partitions of n(n-3)/4 into distinct parts not exceeding n-1. - Alon Amit, Oct 18 2017
a(n) is the coefficient of x^(n*(n+1)/4-1) of Product_{k=2..n} (1+x^k). - Jianing Song, Nov 19 2021

Examples

			1+2-3=0, so a(3)=1;
1-2-3+4=0, so a(4)=1;
1+2-3+4-5-6+7=0, 1+2-3-4+5+6-7=0, 1-2+3+4-5+6-7=0, 1-2-3-4-5+6+7=0, so a(7)=4.
		

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, 0, b(n, n-1)):
    seq(a(n), n=1..60);  # Alois P. Heinz, Oct 30 2011
  • 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]]; Table[ f[n, 0]/2, {n, 1, 50}]
  • PARI
    list(n) = my(poly=vector(n), v=vector(n)); poly[1]=1; for(k=2, n, poly[k]=poly[k-1]*(1+'x^k)); for(k=1, n, if(k%4==1||k%4==2, v[k]=0, v[k]=polcoeff(poly[k], k*(k+1)/4-1))); v \\ Jianing Song, Nov 19 2021

Formula

a(n) is half the coefficient of q^0 in product('(q^(-k)+q^k)', 'k'=1..n) for n >= 1. - Floor van Lamoen, Oct 10 2005
a(4n+1) = a(4n+2) = 0. - Michael Somos, Apr 15 2007
a(n) = [x^n] Product_{k=1..n-1} (x^k + 1/x^k). - Ilya Gutkovskiy, Feb 01 2024

Extensions

More terms from Sascha Kurz, Mar 25 2002
Edited and extended by Robert G. Wilson v, Oct 24 2002

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

A361864 Number of set partitions of {1..n} whose block-medians have integer median.

Original entry on oeis.org

1, 0, 3, 6, 30, 96, 461, 2000, 10727, 57092, 342348
Offset: 1

Views

Author

Gus Wiseman, Apr 04 2023

Keywords

Comments

The median of a multiset is either the middle part (for odd length), or the average of the two middle parts (for even length).

Examples

			The a(1) = 1 through a(4) = 6 set partitions:
  {{1}}  .  {{123}}      {{1}{234}}
            {{13}{2}}    {{123}{4}}
            {{1}{2}{3}}  {{1}{2}{34}}
                         {{12}{3}{4}}
                         {{1}{24}{3}}
                         {{13}{2}{4}}
The set partition {{1,2},{3},{4}} has block-medians {3/2,3,4}, with median 3, so is counted under a(4).
		

Crossrefs

For mean instead of median we have A361865.
For sum instead of outer median we have A361911, means A361866.
A000110 counts set partitions.
A000975 counts subsets with integer median, mean A327475.
A013580 appears to count subsets by median, A327481 by mean.
A308037 counts set partitions with integer average block-size.
A325347 counts partitions w/ integer median, complement A307683.
A360005 gives twice median of prime indices, distinct A360457.

Programs

  • Mathematica
    sps[{}]:={{}};sps[set:{i_,_}]:=Join@@Function[s,Prepend[#,s]& /@ sps[Complement[set,s]]]/@Cases[Subsets[set],{i,_}];
    Table[Length[Select[sps[Range[n]],IntegerQ[Median[Median/@#]]&]],{n,6}]

A361866 Number of set partitions of {1..n} with block-means summing to an integer.

Original entry on oeis.org

1, 1, 1, 3, 8, 22, 75, 267, 1119, 4965, 22694, 117090, 670621, 3866503, 24113829, 161085223, 1120025702, 8121648620, 62083083115, 492273775141, 4074919882483
Offset: 0

Views

Author

Gus Wiseman, Apr 04 2023

Keywords

Examples

			The a(1) = 1 through a(4) = 8 set partitions:
  {{1}}  {{1}{2}}  {{123}}      {{1}{234}}
                   {{13}{2}}    {{12}{34}}
                   {{1}{2}{3}}  {{123}{4}}
                                {{13}{24}}
                                {{14}{23}}
                                {{1}{24}{3}}
                                {{13}{2}{4}}
                                {{1}{2}{3}{4}}
The set partition y = {{1,2},{3,4}} has block-means {3/2,7/2}, with sum 5, so y is counted under a(4).
		

Crossrefs

For mean instead of sum we have A361865, for median A361864.
For median instead of mean we have A361911.
A000110 counts set partitions.
A067538 counts partitions with integer mean, ranks A326836, strict A102627.
A308037 counts set partitions with integer mean block-size.
A327475 counts subsets with integer mean, median A000975.
A327481 counts subsets by mean, median A013580.

Programs

  • Mathematica
    sps[{}]:={{}};sps[set:{i_,_}]:=Join@@Function[s,Prepend[#,s]&/@sps[Complement[set,s]]]/@Cases[Subsets[set],{i,_}];
    Table[Length[Select[sps[Range[n]],IntegerQ[Total[Mean/@#]]&]],{n,6}]

Extensions

a(14)-a(20) from Christian Sievers, May 12 2025

A361911 Number of set partitions of {1..n} with block-medians summing to an integer.

Original entry on oeis.org

1, 1, 3, 10, 30, 107, 479, 2249, 11173, 60144, 351086, 2171087, 14138253, 97097101, 701820663, 5303701310, 41838047938, 343716647215, 2935346815495, 25999729551523, 238473713427285, 2261375071834708, 22141326012712122, 223519686318676559, 2323959300370456901
Offset: 1

Views

Author

Gus Wiseman, Apr 14 2023

Keywords

Comments

The median of a multiset is either the middle part (for odd length), or the average of the two middle parts (for even length).

Examples

			The a(1) = 1 through a(4) = 10 set partitions:
  {{1}}  {{1}{2}}  {{123}}      {{1}{234}}
                   {{13}{2}}    {{12}{34}}
                   {{1}{2}{3}}  {{123}{4}}
                                {{124}{3}}
                                {{13}{24}}
                                {{134}{2}}
                                {{14}{23}}
                                {{1}{24}{3}}
                                {{13}{2}{4}}
                                {{1}{2}{3}{4}}
The set partition {{1,4},{2,3}} has medians {5/2,5/2}, with sum 5, so is counted under a(4).
		

Crossrefs

For median instead of sum we have A361864.
For mean of means we have A361865.
For mean instead of median we have A361866.
A000110 counts set partitions.
A000975 counts subsets with integer median, mean A327475.
A013580 appears to count subsets by median, A327481 by mean.
A308037 counts set partitions with integer average block-size.
A325347 = partitions w/ integer median, complement A307683, strict A359907.
A360005 gives twice median of prime indices, distinct A360457.

Programs

  • Mathematica
    sps[{}]:={{}}; sps[set:{i_,_}] := Join@@Function[s,Prepend[#,s]& /@ sps[Complement[set,s]]] /@ Cases[Subsets[set],{i,_}];
    Table[Length[Select[sps[Range[n]], IntegerQ[Total[Median/@#]]&]],{n,10}]

Extensions

a(12)-a(25) from Christian Sievers, Aug 26 2024

A327449 Number of ways the first n primes can be partitioned into three sets with equal sums.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 423, 0, 2624, 0, 13474, 0, 0, 0, 611736, 0, 4169165, 0, 30926812, 0, 214975174, 0, 1590432628, 0, 11431365932, 0, 83946004461, 0, 0, 0, 4615654888831, 0, 35144700468737, 0, 271133285220726, 0, 2103716957561013, 0, 0, 0, 0, 0, 990170108748552983, 0, 7855344215856348141
Offset: 1

Views

Author

N. J. A. Sloane, Sep 19 2019

Keywords

Comments

It is not true that a(2k+1) is always 0.

Examples

			One of the three solutions for n = 10: 3 + 17 + 23 = 2 + 5 + 7 + 29 = 11 + 13 + 19.
		

References

  • Keith F. Lynch, Posting to Math Fun Mailing List, Sep 17 2019.

Crossrefs

Programs

  • Maple
    s:= proc(n) option remember; `if`(n<2, 0, ithprime(n)+s(n-1)) end:
    b:= proc(n, x, y) option remember; `if`(n=1, 1, (p-> (l->
          add(`if`(p>l[i], 0, b(n-1, sort(subsop(i=l[i]-p, l))
          [1..2][])), i=1..3))([x, y, s(n)-x-y]))(ithprime(n)))
        end:
    a:= n-> `if`(irem(2+s(n), 3, 'q')=0, b(n, q-2, q)/2, 0):
    seq(a(n), n=1..40);  # Alois P. Heinz, Sep 19 2019
  • Mathematica
    s[n_] := s[n] = If[n < 2, 0, Prime[n] + s[n - 1]];
    b[n_, x_, y_] := b[n, x, y] = If[n == 1, 1, Function[p, Function[l, Sum[If[ p > l[[i]], 0, b[n - 1, Sequence @@ Sort[ReplacePart[l, i -> l[[i]] - p]][[1;; 2]]]], {i, 1, 3}]][{x, y, s[n] - x - y}]][Prime[n]]];
    a[n_] := If[Mod[2+s[n], 3]==0, q = Quotient[2+s[n], 3]; b[n, q-2, q]/2, 0];
    Array[a, 40] (* Jean-François Alcover, Apr 09 2020, after Alois P. Heinz *)
  • PARI
    EqSumThreeParts(v)={ my(n=#v, vs=vector(n), m=vecsum(v)/3, brk=0);
      for(i=1, n-1, vs[i+1]=vs[i]+v[i]; if(vs[i]<=min(1000,m), brk=i));
      my(q=Vecrev(prod(i=1, brk, 1+x^v[i]+y^v[i])));
      my(recurse(k,s,p)=if(k==brk, if(s<#q, polcoef(p*q[s+1],m,y)), if(s<=vs[k], self()(k-1, s, p*(1 + y^v[k]))) + if(s>=v[k], self()(k-1, s-v[k], p)) ));
      if(frac(m), 0, recurse(n-1, m, 1 + O(y*y^m))/2);
    }
    a(n)={EqSumThreeParts(primes(n))} \\ Andrew Howroyd, Sep 19 2019

Formula

a(n) > 0 <=> n in { A103208 }, with odd n in { A111320 }. - Alois P. Heinz, Sep 19 2019

Extensions

Corrected and a(30)-a(52) added by Andrew Howroyd, Sep 19 2019
a(53) and beyond from Alois P. Heinz, Sep 19 2019

A361865 Number of set partitions of {1..n} such that the mean of the means of the blocks is an integer.

Original entry on oeis.org

1, 0, 3, 2, 12, 18, 101, 232, 1547, 3768, 24974, 116728, 687419, 3489664, 26436217, 159031250, 1129056772
Offset: 1

Views

Author

Gus Wiseman, Apr 04 2023

Keywords

Examples

			The set partition y = {{1,4},{2,5},{3}} has block-means {5/2,7/2,3}, with mean 3, so y is counted under a(5).
The a(1) = 1 through a(5) = 12 set partitions:
  {{1}}  .  {{123}}      {{1}{234}}  {{12345}}
            {{13}{2}}    {{123}{4}}  {{1245}{3}}
            {{1}{2}{3}}              {{135}{24}}
                                     {{15}{234}}
                                     {{1}{234}{5}}
                                     {{12}{3}{45}}
                                     {{135}{2}{4}}
                                     {{14}{25}{3}}
                                     {{15}{24}{3}}
                                     {{1}{24}{3}{5}}
                                     {{15}{2}{3}{4}}
                                     {{1}{2}{3}{4}{5}}
		

Crossrefs

For median instead of mean we have A361864.
For sum instead of outer mean we have A361866, median A361911.
A000110 counts set partitions.
A067538 counts partitions with integer mean, ranks A326836, strict A102627.
A308037 counts set partitions whose block-sizes have integer mean.
A327475 counts subsets with integer mean, median A000975.

Programs

  • Mathematica
    sps[{}]:={{}};sps[set:{i_,_}]:=Join@@Function[s,Prepend[#,s]& /@ sps[Complement[set,s]]]/@Cases[Subsets[set],{i,_}];
    Table[Length[Select[sps[Range[n]],IntegerQ[Mean[Mean/@#]]&]],{n,6}]

Extensions

a(13)-a(17) from Christian Sievers, Jun 30 2025

A327450 Number of ways the first n squares can be partitioned into three sets with equal sums.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 137, 211, 0, 0, 0, 3035, 0, 0, 0, 120465, 259383, 0, 0, 0, 12328889, 0, 0, 0, 673380980, 1659966694, 0, 0, 0, 69819104134, 0, 0, 0, 3761284888715, 9660240745536, 0, 0, 0, 537238185892321, 0, 0, 0, 29922345673502904
Offset: 1

Views

Author

N. J. A. Sloane, Sep 20 2019

Keywords

Examples

			The unique smallest solution (for n = 13) is 1 + 9 + 25 + 36 + 81 + 121 = 16 + 49 + 64 + 144 = 4 + 100 + 169.
		

References

  • Keith F. Lynch, Posting to Math Fun Mailing List, Sep 19 2019.

Crossrefs

Programs

  • Maple
    s:= proc(n) option remember; `if`(n<2, 0, n^2+s(n-1)) end:
    b:= proc(n, x, y) option remember; `if`(n=1, 1, (p-> (l->
          add(`if`(p>l[i], 0, b(n-1, sort(subsop(i=l[i]-p, l))
                 [1..2][])), i=1..3))([x, y, s(n)-x-y]))(n^2))
        end:
    a:= n-> `if`(irem(1+s(n), 3, 'q')=0, b(n, q-1, q)/2, 0):
    seq(a(n), n=1..27);  # Alois P. Heinz, Sep 29 2019
  • Mathematica
    s[n_] := s[n] = If[n < 2, 0, n^2 + s[n - 1]];
    b[n_, x_, y_] := b[n, x, y] = Module[{p, l}, If[n == 1, 1, p = n^2; l = {x, y, s[n] - x - y}; Sum[If[p > l[[i]], 0, b[n - 1, Sequence @@ Sort[ ReplacePart[l, i -> l[[i]] - p]][[1 ;; 2]]]], {i, 1, 3}]]];
    a[n_] := Module[{q, r}, {q, r} = QuotientRemainder[1 + s[n], 3]; If[r == 0, b[n, q - 1, q]/2, 0]];
    Array[a, 30] (* Jean-François Alcover, Dec 04 2020, after Alois P. Heinz *)

Formula

a(n) > 0 => n in { A140282 }. - Alois P. Heinz, Sep 29 2019

Extensions

a(28)-a(45) from Alois P. Heinz, Sep 29 2019
a(46)-a(53) from Alois P. Heinz, Oct 05 2019

A327448 Number of ways the first n cubes can be partitioned into three sets with equal sums.

Original entry on oeis.org

1, 0, 0, 691, 3416, 0, 233, 1168, 0, 8857, 18157, 0, 2176512, 3628118, 0, 3204865, 8031495, 0, 79514209, 205927212, 0, 5152732369, 13493840291, 0
Offset: 23

Views

Author

N. J. A. Sloane, Sep 19 2019

Keywords

Comments

Note the offset.

Examples

			The unique smallest solution (for n = 23) is
27 + 216 + 1000 + 2197 + 5832 + 6859 + 9261 =
1 + 64 + 343 + 512 + 1728 + 4096 + 8000 + 10648 =
8 + 125 + 729 + 1331 + 2744 + 3375 + 4913 + 12167.
		

References

  • Keith F. Lynch, Posting to Math Fun Mailing List, Sep 17 2019.

Crossrefs

Programs

  • Maple
    s:= proc(n) option remember; `if`(n<2, 0, n^3+s(n-1)) end:
    b:= proc(n, x, y) option remember; `if`(n=1, 1, (p-> (l->
          add(`if`(p>l[i], 0, b(n-1, sort(subsop(i=l[i]-p, l))
                [1..2][])), i=1..3))([x, y, s(n)-x-y]))(n^3))
        end:
    a:= n-> `if`(irem(1+s(n), 3, 'q')=0, b(n, q-1, q)/2, 0):
    seq(a(n), n=23..27);  # Alois P. Heinz, Sep 30 2019
  • Mathematica
    s[n_] := s[n] = If[n < 2, 0, n^3 + s[n - 1]];
    b[n_, x_, y_] := b[n, x, y] = If[n == 1, 1, With[{p = n^3}, Sum[If[p > #[[i]], 0, b[n - 1, Sequence @@ Sort[ReplacePart[#, i -> #[[i]] - p]][[1 ;; 2]]]], {i, 1, 3}]]&[{x, y, s[n] - x - y}]];
    a[n_] := a[n] = If[q = Quotient[1 + s[n], 3]; Mod[1 + s[n], 3] == 0, b[n, q - 1, q]/2, 0];
    Table[Print[n, " ", a[n]]; a[n], {n, 23, 34}] (* Jean-François Alcover, Nov 08 2020, after Alois P. Heinz *)

Formula

a(n) > 0 => n in { A007494 }. - Alois P. Heinz, Sep 30 2019

Extensions

a(32), a(33), a(35) recomputed and a(36)-a(38) added by Alois P. Heinz, Sep 30 2019
a(39)-a(46) from Bert Dobbelaere, May 15 2021
Showing 1-10 of 16 results. Next