OFFSET
1,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..1000
Paul T. Bateman, Adolf J. Hildebrand, and George B. Purdy, Sums of distinct squares, Acta Arithmetica 67 (1994), pp. 349-380.
Franz Halter-Koch, Darstellung natürlicher Zahlen als Summe von Quadraten, Acta Arithmetica 42 (1982), pp. 11-20.
Index entries for linear recurrences with constant coefficients, signature (2,-1).
FORMULA
a(n) = n + 124 for n > 121. [Charles R Greathouse IV, Jul 17 2011]
PROG
(PARI) upto(lim)=my(v=List(), tb, tc, td, te); for(a=5, sqrt(lim), for(b=4, min(a-1, sqrt(lim-a^2)), tb=a^2+b^2; for(c=3, min(b-1, sqrt(lim-tb)), tc=tb+c^2; for(d=2, min(c-1, sqrt(lim-tc)), td=tc+d^2; for(e=1, d-1, te=td+e^2; if(te>lim, break, listput(v, te))))))); vecsort(Vec(v), , 8) \\ Charles R Greathouse IV, Jul 17 2011
(Haskell)
a004434 n = a004434_list !! (n-1)
a004434_list = filter (p 5 $ tail a000290_list) [1..] where
p k (q:qs) m = k == 0 && m == 0 ||
q <= m && k >= 0 && (p (k - 1) qs (m - q) || p k qs m)
-- Reinhard Zumkeller, Apr 22 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved