login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A102548 Number of positive integers <= n that are expressible in the form u^2+v^2, with u and v integers. 3

%I #34 Apr 18 2023 09:42:44

%S 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,

%T 15,15,15,16,16,17,17,18,19,19,19,20,21,21,21,21,22,22,22,22,23,24,24,

%U 25,26,26,26,26,26,27,27,27,28,28,28,29,30,30,30,31,31,31,31,32,33,34,34

%N Number of positive integers <= n that are expressible in the form u^2+v^2, with u and v integers.

%H David A. Corneth, <a href="/A102548/b102548.txt">Table of n, a(n) for n = 1..10000</a>

%H Yoichi Motohashi, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa16/aa1633.pdf">On the distribution of prime numbers which are of the form x^2+y^2+1</a>, Acta Arith. 16 (1969/70), 351-363. MR0288086 (44 #5284). See Eq. (1.2).

%H D. Shanks, <a href="http://dx.doi.org/10.1090/S0025-5718-1964-0159174-9">The second-order term in the asymptotic expansion of B(x)</a>, Mathematics of Computation 18 (1964), pp. 75-86.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Landau-RamanujanConstant.html">Landau-Ramanujan Constant</a>.

%F From _David A. Corneth_, Jun 05 2020: (Start)

%F A000161(a(n)) > 0.

%F a(n) = (partial sum of A229062 up to n) - 1. (End)

%F 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

%e 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.

%p 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:

%t 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 *)

%o (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

%o (Python)

%o from itertools import count, accumulate, islice

%o from sympy import factorint

%o def A102548_gen(): # generator of terms

%o return accumulate(int(all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(n).items())) for n in count(1))

%o A102548_list = list(islice(A102548_gen(),30)) # _Chai Wah Wu_, Jun 28 2022

%Y Cf. A000161, A000691, A001481, A229062.

%K nonn,easy

%O 1,2

%A Salvador Perez Gomez (pies314(AT)hotmail.com), Feb 24 2005

%E Name clarified by _David A. Corneth_, Jun 05 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 18 20:50 EDT 2024. Contains 375284 sequences. (Running on oeis4.)