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.

A083527 a(n) is the number of times that sums 1+-4+-9+-16+-...+-n^2 of the first n squares is zero. There are 2^(n-1) choices for the sign patterns.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 5, 0, 0, 43, 57, 0, 0, 239, 430, 0, 0, 2904, 5419, 0, 0, 27813, 50213, 0, 0, 348082, 649300, 0, 0, 3913496, 7287183, 0, 0, 50030553, 93696497, 0, 0, 611793542, 1161079907, 0, 0, 8009933135, 15176652567, 0, 0
Offset: 1

Views

Author

T. D. Noe, Apr 29 2003

Keywords

Comments

The frequency of each possible sum is computed by the Mathematica program without explicitly computing the individual sums.
a(n) is the maximal number of subsets of the first n squares that share the same sum. Cf. A025591, A083309.
a(n)=0 when n==1 or 2 (mod 4).

Examples

			a(7) = 1 because there is only one sign pattern of the first seven squares that yields zero: 1+4-9+16-25-36+49.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, i) option remember; local m;
          m:= (1+(3+2*i)*i)*i/6;
          `if`(n>m, 0, `if`(n=m, 1, b(abs(n-i^2), i-1) +b(n+i^2, i-1)))
        end:
    a:= n-> `if`(irem(n-1, 4)<2, 0, b(n^2, n-1)):
    seq(a(n), n=1..40);  # Alois P. Heinz, Oct 31 2011
  • Mathematica
    d={1, 1}; nMax=60; zeroLst={0}; Do[p=n^2; d=PadLeft[d, Length[d]+p]+PadRight[d, Length[d]+p]; If[1==Mod[Length[d], 2], AppendTo[zeroLst, d[[(Length[d]+1)/2]]], AppendTo[zeroLst, 0]], {n, 2, nMax}]; zeroLst/2
    p = 1; t = {}; Do[p = Expand[p(x^(n^2) + x^(-n^2))]; AppendTo[t, Select[p, NumberQ[ # ] &]/2], {n, 51}]; t (* Robert G. Wilson v, Oct 31 2005 *)
  • PARI
    a(n)=sum(i=0,2^(n-1)-1,sum(j=1,n-1,(-1)^bittest(i,j-1)*j^2)==n^2) \\ Charles R Greathouse IV, Nov 05 2012

Formula

a(n) is half the coefficient of x^0 in the product_{k=1..n} x^(k^2)+x^(k^-2).
a(n) = A158092(n)/2.
a(n) = [x^(n^2)] Product_{k=1..n-1} (x^(k^2) + 1/x^(k^2)). - Ilya Gutkovskiy, Feb 01 2024

A158118 Number of solutions of +-1+-2^3+-3^3..+-n^3=0.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 4, 2, 0, 0, 4, 124, 0, 0, 536, 712, 0, 0, 4574, 2260, 0, 0, 10634, 73758, 0, 0, 406032, 638830, 0, 0, 4249160, 3263500, 0, 0, 21907736, 82561050, 0, 0, 485798436, 945916970, 0, 0, 5968541478, 6839493576, 0, 0
Offset: 1

Views

Author

Pietro Majer, Mar 12 2009

Keywords

Comments

Constant term in the expansion of (x + 1/x)(x^8 + 1/x^8)..(x^n^3 + 1/x^n^3).
a(n) = 0 for any n=1 (mod 4) or n=2 (mod 4).
The expansion above and the integral representation formula below are due to Andrica & Tomescu. The asymptotic formula is a conjecture; see Andrica & Ionascu. - Jonathan Sondow, Nov 06 2013

Examples

			Example: For n=12 the a(12) = 2 solutions are:
+1+8-27+64-125-216-343+512+729-1000-1331+1728=0,
-1-8+27-64+125+216+343-512-729+1000+1331-1728=0.
		

Crossrefs

Equals twice A113263.
Cf. A063865, A158092, A019568. - Pietro Majer, Mar 15 2009

Programs

  • Maple
    N:=60: p:=1: a:=[]: for n from 1 to N do p:=expand(p*( x^(n^3) + x^(-n^3) )): a:=[op(a), coeff(p,x,0)]: od:a;

Formula

a(n) = 2 * A113263(n).
Integral representation: a(n)=((2^n)/Pi)*int_0^Pi prod_{k=1}^n cos(x*k^3) dx.
Asymptotic formula: a(n)=(2^n)*sqrt(14/(Pi*n^7))*(1+o(1)) as n-->infty; n=-1 or 0 (mod 4).

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

A111253 a(n) is the number of ways the set {1^4, 2^4, ..., n^4} can be partitioned into two sets of equal sums.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 8, 9, 0, 0, 16, 50, 0, 0, 212, 255, 0, 0, 1396, 2994, 0, 0, 14529, 22553, 0, 0, 138414, 236927, 0, 0, 1227670, 2388718, 0, 0, 13733162, 23214820, 0, 0, 140197641, 263244668, 0, 0, 1596794975, 2830613464, 0, 0
Offset: 1

Views

Author

Robert G. Wilson v, Oct 31 2005

Keywords

Comments

a(n)=0 when n == 1 or 2 (mod 4).

Crossrefs

Programs

  • Maple
    b:= proc(n, i) option remember; local m;
          m:= (-1+(10+(15+6*i)*i)*i^2)*i/30;
          `if`(n>m, 0, `if`(n=m, 1, b(abs(n-i^4), i-1) +b(n+i^4, i-1)))
        end:
    a:= n-> `if`(irem(n-1, 4)<2, 0, b(n^4, n-1)):
    seq(a(n), n=1..38);  # Alois P. Heinz, Oct 30 2011
  • Mathematica
    d = {1, 1}; nMax=50; zeroLst = {0}; Do[p = n^4; d = PadLeft[d, Length[d] + p] + PadRight[d, Length[d] + p]; If[1 == Mod[Length[d], 2], AppendTo[zeroLst, d[[(Length[d] + 1)/2]]], AppendTo[zeroLst, 0]], {n, 2, nMax}]; zeroLst/2 (* T. D. Noe, Oct 31 2005 *)
    p = 1; t = {}; Do[p = Expand[p(x^(n^4) + x^(-n^4))]; AppendTo[t, Select[p, NumberQ[ # ] &]/2], {n, 30}]; t

Formula

a(n) is half the coefficient of x^0 in product_{k=1..n} x^(k^4)+x^(k^-4).
a(n) = [x^(n^4)] Product_{k=1..n-1} (x^(k^4) + 1/x^(k^4)). - Ilya Gutkovskiy, Feb 01 2024

Extensions

a(51)-a(54) from T. D. Noe, Nov 01 2005
Corrected a(51)-a(52) and extended up to a(58) by Alois P. Heinz, Oct 31 2011

A300269 Number of solutions to 1 +- 8 +- 27 +- ... +- n^3 == 0 (mod n).

Original entry on oeis.org

1, 0, 2, 4, 4, 0, 20, 48, 80, 0, 94, 344, 424, 0, 1096, 4864, 3856, 0, 16444, 52432, 65248, 0, 182362, 720928, 671104, 0, 4152320, 11156656, 9256396, 0, 34636834, 135397376, 130150588, 0, 533834992, 2773200896, 1857304312, 0, 7065319328, 27541477824, 26817356776
Offset: 1

Views

Author

Seiichi Manyama, Mar 01 2018

Keywords

Examples

			Solutions for n = 7:
-----------------------------------
1 +8 +27 +64 +125 +216 +343 =  784.
1 +8 +27 +64 +125 +216 -343 =   98.
1 +8 +27 -64 +125 -216 +343 =  224.
1 +8 +27 -64 +125 -216 -343 = -462.
1 +8 +27 -64 -125 +216 +343 =  406.
1 +8 +27 -64 -125 +216 -343 = -280.
1 +8 -27 -64 +125 +216 +343 =  602.
1 +8 -27 -64 +125 +216 -343 =  -84.
1 -8 +27 +64 +125 -216 +343 =  336.
1 -8 +27 +64 +125 -216 -343 = -350.
1 -8 +27 +64 -125 +216 +343 =  518.
1 -8 +27 +64 -125 +216 -343 = -168.
1 -8 +27 -64 -125 -216 +343 =  -42.
1 -8 +27 -64 -125 -216 -343 = -728.
1 -8 -27 +64 +125 +216 +343 =  714.
1 -8 -27 +64 +125 +216 -343 =   28.
1 -8 -27 -64 +125 -216 +343 =  154.
1 -8 -27 -64 +125 -216 -343 = -532.
1 -8 -27 -64 -125 +216 +343 =  336.
1 -8 -27 -64 -125 +216 -343 = -350.
		

Crossrefs

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

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^3, m-i^3]))
        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^3, m - i^3}}]];
    a[n_] := b[0, n - 1, n];
    Table[a[n], {n, 1, 60}] (* Jean-François Alcover, Mar 19 2022, after Alois P. Heinz *)
  • PARI
    a(n) = my (v=vector(n,k,k==1)); for (i=2, n, v = vector(n, k, v[1 + (k-i^3)%n] + v[1 + (k+i^3)%n])); v[1] \\ Rémy Sigrist, Mar 01 2018
  • Ruby
    def A(n)
      ary = [1] + Array.new(n - 1, 0)
      (1..n).each{|i|
        i3 = 2 * i * i * i
        a = ary.clone
        (0..n - 1).each{|j| a[(j + i3) % n] += ary[j]}
        ary = a
      }
      ary[((n * (n + 1)) ** 2 / 4) % n] / 2
    end
    def A300269(n)
      (1..n).map{|i| A(i)}
    end
    p A300269(100)
    

Extensions

More terms from Alois P. Heinz, Mar 01 2018

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

A350861 Number of solutions to +-1^3 +- 2^3 +- 3^3 +- ... +- n^3 = 0 or 1.

Original entry on oeis.org

1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 4, 1, 4, 2, 6, 1, 4, 124, 12, 344, 536, 712, 1140, 713, 4574, 2260, 4384, 5956, 10634, 73758, 48774, 197767, 406032, 638830, 1147500, 1097442, 4249160, 3263500, 6499466, 11844316, 21907736, 82561050, 85185855, 261696060
Offset: 0

Views

Author

Ilya Gutkovskiy, Jan 19 2022

Keywords

Examples

			a(12) = 2: +1^3 + 2^3 - 3^3 + 4^3 - 5^3 - 6^3 - 7^3 + 8^3 + 9^3 - 10^3 - 11^3 + 12^3 = -1^3 - 2^3 + 3^3 - 4^3 + 5^3 + 6^3 + 7^3 - 8^3 - 9^3 + 10^3 + 11^3 - 12^3 = 0.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local S,k,x,s;
      S:= mul(1 + x^(2*k^3),k=1..n);
      s:= sum(k^3,k=1..n);
      coeff(S,x,s) + coeff(S,x,s+1)
    end proc:
    map(f, [$0..50]); # Robert Israel, Mar 15 2023
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def b(n, i):
        if n > (i*(i+1)//2)**2: return 0
        if i == 0: return 1
        return b(n+i**3, i-1) + b(abs(n-i**3), i-1)
    def a(n): return b(0, n) + b(1, n)
    print([a(n) for n in range(46)]) # Michael S. Branicky, Jan 19 2022
Showing 1-8 of 8 results.