A237526 a(n) = number of unit squares in the first quadrant of a disk of radius sqrt(n) centered at the origin of a square lattice.
0, 0, 1, 1, 1, 3, 3, 3, 4, 4, 6, 6, 6, 8, 8, 8, 8, 10, 11, 11, 13, 13, 13, 13, 13, 15, 17, 17, 17, 19, 19, 19, 20, 20, 22, 22, 22, 24, 24, 24, 26, 28, 28, 28, 28, 30, 30, 30, 30, 30, 33, 33, 35, 37, 37, 37, 37, 37, 39, 39, 39, 41, 41, 41, 41, 45, 45, 45, 47, 47
Offset: 0
Keywords
Links
- Stefano Spezia, Table of n, a(n) for n = 0..10000
Programs
-
Mathematica
a[n_]:=Sum[Floor[Sqrt[n-k^2]],{k,Floor[Sqrt[n]]}]; Array[a,70,0] (* Stefano Spezia, Jul 19 2024 *)
-
PARI
A237526(n)=sum(k=1,sqrtint(n),sqrtint(n-k^2)) \\ M. F. Hasler, Feb 09 2014
-
Python
from math import isqrt def A237526(n): return sum(isqrt(n-k**2) for k in range(1,isqrt(n)+1)) # Chai Wah Wu, Jul 18 2024
Formula
a(n) = Sum_{k=1..floor(sqrt(n))} floor(sqrt(n-k^2)). - M. F. Hasler, Feb 09 2014
G.f.: (theta_3(x) - 1)^2/(4*(1 - x)), where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 17 2018
For n > 1, Pi*(n+2-sqrt(8n)) < a(n) < Pi*n. (This is trivial and can probably be improved by methods like Euler-Maclaurin and perhaps even a modification of the Dirichlet hyperbola method.) - Charles R Greathouse IV, Jul 17 2024