login
A078183
Number of solutions to x^2 + y^2 + z^2 < n^2; number of lattice points inside a sphere of radius n.
3
0, 1, 27, 93, 251, 485, 895, 1365, 2103, 2969, 4139, 5497, 7123, 9093, 11459, 13997, 17071, 20377, 24303, 28545, 33371, 38641, 44395, 50733, 57747, 65117, 73447, 82201, 91911, 101769, 112931, 124289, 137059, 150165, 164415, 179309, 195167
OFFSET
0,3
FORMULA
a(n) = A000605(n) - A016725(n)
MATHEMATICA
s = 0; Table[s = s + Sum[SquaresR[3, k], {k, (n - 1)^2, n^2 - 1}], {n, 0, 50}]
PROG
(Python)
from math import prod, isqrt
from sympy import factorint
def A078183(n): return 1+((n<<1)+sum(1+((s:=isqrt(t:=(n+k)*(n-k)))<<1)+(sum(isqrt(t-m**2) for m in range(s+1))<<2) for k in range(1, n+1))<<1)-6*prod(p**e+(0 if p&3==1 else (p**e-1)//(p-1)<<1) for p, e in factorint(n>>(~n & n-1).bit_length()).items()) if n else 0 # Chai Wah Wu, Feb 22 2026
CROSSREFS
Sequence in context: A286192 A101100 A226359 * A072252 A154041 A233156
KEYWORD
nonn
AUTHOR
T. D. Noe, Nov 21 2002
STATUS
approved