login
A102548
Number of positive integers <= n that are expressible in the form u^2+v^2, with u and v integers.
3
1, 2, 2, 3, 4, 4, 4, 5, 6, 7, 7, 7, 8, 8, 8, 9, 10, 11, 11, 12, 12, 12, 12, 12, 13, 14, 14, 14, 15, 15, 15, 16, 16, 17, 17, 18, 19, 19, 19, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 24, 24, 25, 26, 26, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 30, 30, 30, 31, 31, 31, 31, 32, 33, 34, 34
OFFSET
1,2
LINKS
Yoichi Motohashi, On the distribution of prime numbers which are of the form x^2+y^2+1, Acta Arith. 16 (1969/70), 351-363. MR0288086 (44 #5284). See Eq. (1.2).
D. Shanks, The second-order term in the asymptotic expansion of B(x), Mathematics of Computation 18 (1964), pp. 75-86.
Eric Weisstein's World of Mathematics, Landau-Ramanujan Constant.
FORMULA
From David A. Corneth, Jun 05 2020: (Start)
A000161(a(n)) > 0.
a(n) = (partial sum of A229062 up to n) - 1. (End)
a(n) = n/sqrt(log n) * (K + B2/log n + O(1/log^2 n)), where K = A064533 and B2 = A227158. In particular, a(n) ~ Kn/sqrt(log n). - Charles R Greathouse IV, Dec 03 2022
EXAMPLE
a(8) = 5 because 1 = 0^2 + 1^2, 2 = 1^2 + 1^2, 4 = 0^2 + 2^2, 5 = 1^2 + 2^2, 8 = 2^2 + 2^2, but 3,6 and 7 are not of the form u^2 + v^2, with u and v integers.
MAPLE
a := proc(n) local aux, i, m, u, v; aux:=0; for i from 1 to n do m:=floor(sqrt(i/2)); for u from 0 to m do v:=sqrt(i-u^2); if (v = floor(v)) then aux:=aux+1; u:=m; end if; end do; end do; aux; end proc:
MATHEMATICA
a[1]=1; a[n_]:= a[n]= a[n-1] + If[SquaresR[2, n]>0, 1, 0]; Table[a[n], {n, 75}] (* Jean-François Alcover, Mar 31 2015 *)
PROG
(PARI) first(n)= my(v = vector(n + 1), res = vector(n)); res[1] = 1; for(i = 0, sqrtint(n), for(j = i, sqrtint(n - i^2), v[i^2+j^2+1] = 1 ) ); for(i = 2, #res, res[i] = res[i-1] + v[i+1]; ); res \\ David A. Corneth, Jun 05 2020
(Python)
from itertools import count, accumulate, islice
from sympy import factorint
def A102548_gen(): # generator of terms
return accumulate(int(all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(n).items())) for n in count(1))
A102548_list = list(islice(A102548_gen(), 30)) # Chai Wah Wu, Jun 28 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Salvador Perez Gomez (pies314(AT)hotmail.com), Feb 24 2005
EXTENSIONS
Name clarified by David A. Corneth, Jun 05 2020
STATUS
approved