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

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

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

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
Showing 1-3 of 3 results.