OFFSET
0,2
REFERENCES
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Seth A. Troisi, Table of n, a(n) for n = 0..50 (terms 0..35 from N. J. A. Sloane)
P. Moree and H. J. J. te Riele, The hexagonal versus the square lattice, arXiv:math/0204332 [math.NT], 2002.
P. Moree and H. J. J. te Riele, The hexagonal versus the square lattice, Math. Comp. 73 (2004), no. 245, 451-473.
D. Shanks and L. P. Schmid, Variations on a theorem of Landau. Part I, Math. Comp., 20 (1966), 551-569.
Seth A. Troisi, C++ program
EXAMPLE
There are 5 integers <= 2^3 of the form x^2 + y^2. The five (x,y) pairs (x <= y) are (0,1), (1,1), (0,2), (1,2), (2,2) and give the integers 1, 2, 4, 5, 8, respectively. So a(3) = 5. - Seth A. Troisi, Apr 27 2022
MATHEMATICA
(* This program is not suitable for a large number of terms *) a[0] = 1; a[n_] := a[n] = (For[cnt = 0; k = 2^(n-1)+1, k <= 2^n, k++, If[SquaresR[2, k] > 0, cnt++]]; cnt + a[n-1]); Table[Print["a(", n, ") = ", a[n]]; a[n], {n, 0, 26}] (* Jean-François Alcover, Mar 20 2014 *)
PROG
(Haskell)
isqrt = a000196
issquare = a010052
a000050 n = foldl f 0 [1..2^n]
where f i j = if a000050' j > 0 then i + 1 else i
a000050' k = foldl f 0 (h k)
where f i y = g y + i
where g y = issquare (k - y^2)
h k = [0..isqrt k]
-- James Spahlinger, Oct 09 2012
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved