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.

A003995 Sum of (any number of) distinct squares: of form r^2 + s^2 + t^2 + ... with 0 <= r < s < t < ...

This page as a plain text file.
%I A003995 #39 Jan 14 2025 23:08:53
%S A003995 0,1,4,5,9,10,13,14,16,17,20,21,25,26,29,30,34,35,36,37,38,39,40,41,
%T A003995 42,45,46,49,50,51,52,53,54,55,56,57,58,59,61,62,63,64,65,66,68,69,70,
%U A003995 71,73,74,75,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,93,94,95,97
%N A003995 Sum of (any number of) distinct squares: of form r^2 + s^2 + t^2 + ... with 0 <= r < s < t < ...
%H A003995 T. D. Noe, <a href="/A003995/b003995.txt">Table of n, a(n) for n = 1..1000</a>
%H A003995 <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>
%H A003995 <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (2,-1).
%F A003995 Exponents in expansion of (1+x)*(1+x^4)*(1+x^9)*(1+x^16)*(1+x^25)*(1+x^36)*(1+x^49)*(1+x^64)*(1+x^81)*(1+x^100)*(1+x^121)*(1+x^144)*...
%F A003995 For n > 98, a(n) = n + 30. - _Charles R Greathouse IV_, Sep 02 2011 (This implies a(n+2) = 2*a(n+1)-a(n) for n > 98.)
%t A003995 lim = 10; s = {0}; Do[s = Union[s, s + n^2], {n, lim}]; Select[s, 0 <= # <= lim^2 &] (* _T. D. Noe_, Jul 10 2012 *)
%o A003995 (PARI) a(n)=if(n<1,0,n=a(n-1); until(polcoeff(prod(k=1,sqrt(n),1+x^k^2), n), n++); n)
%o A003995 (Haskell)
%o A003995 a003995 n = a003995_list !! (n-1)
%o A003995 a003995_list = filter (p a000290_list) [0..]
%o A003995    where p (q:qs) m = m == 0 || q <= m && (p qs (m - q) || p qs m)
%o A003995 -- _Reinhard Zumkeller_, Apr 22 2013
%Y A003995 Cf. A001983, A033461, A008935. Complement of A001422.
%Y A003995 Cf. A000290; subsequences: A004431, A004432, A004433, A004434, A224981, A224982, A224983.
%K A003995 nonn,easy,nice
%O A003995 1,3
%A A003995 _N. J. A. Sloane_