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.

A248509 Length of longest sequence of distinct nonzero squares summing to n, or 0 if no such sequence exists.

This page as a plain text file.
%I A248509 #14 Mar 04 2019 22:57:18
%S A248509 1,0,0,1,2,0,0,0,1,2,0,0,2,3,0,1,2,0,0,2,3,0,0,0,2,3,0,0,3,4,0,0,0,2,
%T A248509 3,1,2,3,4,2,3,3,0,0,3,4,0,0,3,4,4,2,3,4,5,3,4,2,3,0,3,4,4,1,4,5,0,2,
%U A248509 3,4,4,0,2,4,5,0,3,4,5,2,4,5,3,4
%N A248509 Length of longest sequence of distinct nonzero squares summing to n, or 0 if no such sequence exists.
%C A248509 a(n) >= k for n > A129210(k).
%C A248509 a(n) > 0 iff A033461(n) > 0. - _Reinhard Zumkeller_, Oct 07 2014
%H A248509 Robert Israel, <a href="/A248509/b248509.txt">Table of n, a(n) for n = 1..10000</a>
%H A248509 P. T. Bateman, A. J. Hildebrand and G. B. Purdy, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa67/aa6745.pdf">Sums of distinct squares</a>, Acta Arithmetica 67 (1994), pp. 349-380.
%H A248509 Eryk Pawilan, <a href="http://mathoverflow.net/questions/182714/longest-sequence-of-sum-of-distinct-squares/182728#182728">Math Overflow question</a>
%e A248509 1 = 1^2 so a(1) = 1.
%e A248509 2 and 3 are not sums of distinct squares, so a(2) = 0 and a(3) = 0.
%e A248509 4 = 2^2 so a(4) = 1.
%e A248509 5 = 1^2 + 2^2 so a(5) = 2.
%p A248509 N:= 100: # to get a(1) to a(N)
%p A248509 M:= floor(sqrt(N)):
%p A248509 A:= Array(0..N,0..M):
%p A248509 sj:= unapply(sum(k^2,k=1..x),x):
%p A248509 for j from 1 to M do
%p A248509   for n from sj(j)+1 to N do A[n,j]:= -infinity od:
%p A248509   for n from 1 to j^2-1 do A[n,j]:= A[n,j-1] od:
%p A248509   for n from j^2 to min(sj(j),N) do A[n,j]:= max(A[n,j-1],1+A[n-j^2,j-1]) od:
%p A248509 od:
%p A248509 subs(-infinity=0,[seq(A[n,M],n=1..N)]); # _Robert Israel_, Oct 07 2014
%t A248509 Nt = 100 (* = number of terms *);
%t A248509 M = Floor[Sqrt[Nt]];
%t A248509 Clear[A]; A[_, _] = 0;
%t A248509 s[j_] := Range[j].Range[j];
%t A248509 For[j = 1, j <= M, j++,
%t A248509   For[n = s[j] + 1, n <= Nt, n++, A[n, j] = -Infinity];
%t A248509   For[n = 1, n <= j^2 - 1, n++, A[n, j] = A[n, j - 1]];
%t A248509   For[n = j^2, n <= Min[s[j], Nt], n++, A[n, j] = Max[A[n, j-1], 1+A[nj^2, j-1]]]
%t A248509 ];
%t A248509 Table[A[n, M] /. DirectedInfinity[-1] -> 0, {n, 1, Nt}] (* _Jean-François Alcover_, Mar 04 2019, after _Robert Israel_ *)
%Y A248509 Cf. A129210.
%Y A248509 Cf. A033461.
%K A248509 nonn
%O A248509 1,5
%A A248509 _Robert Israel_, Oct 07 2014