login
Number of nonnegative solutions to x^2 + y^2 <= n^2.
(Formerly M2541 N1004)
14

%I M2541 N1004 #52 Jul 18 2024 14:29:28

%S 1,3,6,11,17,26,35,45,58,73,90,106,123,146,168,193,216,243,271,302,

%T 335,365,402,437,473,516,557,600,642,687,736,782,835,886,941,999,1050,

%U 1111,1167,1234,1297,1357,1424,1491,1564,1636,1703,1778,1852,1931,2012,2095

%N Number of nonnegative solutions to x^2 + y^2 <= n^2.

%C Row sums of triangle A255238. - _Wolfdieter Lang_, Mar 15 2015

%D H. Gupta, A Table of Values of N_3(t), Proc. National Institute of Sciences of India, 13 (1947), 35-63.

%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H T. D. Noe, <a href="/A000603/b000603.txt">Table of n, a(n) for n = 0..1000</a>

%F a(n) = n^2 * Pi/4 + O(n). - _Charles R Greathouse IV_, Apr 03 2013

%F a(n) = A001182(n) + 2*n + 1. - _R. J. Mathar_, Jan 07 2015

%F a(n) = 2*A026702(n) - (1 + floor(n/sqrt(2))), n >= 0. - _Wolfdieter Lang_, Mar 15 2015

%F a(n) = [x^(n^2)] (1 + theta_3(x))^2/(4*(1 - x)), where theta_3() is the Jacobi theta function. - _Ilya Gutkovskiy_, Apr 15 2018

%t Table[cnt = 0; Do[If[x^2 + y^2 <= n^2, cnt++], {x, 0, n}, {y, 0, n}]; cnt, {n, 0, 51}] (* _T. D. Noe_, Apr 02 2013 *)

%t Table[If[n==1,1,2*Sum[Sum[A255195[[n, n - k + 1]], {k, 1, k}], {k, 1, n}] - Ceiling[(n - 1)/Sqrt[2]]],{n,1,52}] (* _Mats Granvik_, Feb 19 2015 *)

%o (Haskell)

%o a000603 n = length [(x,y) | x <- [0..n], y <- [0..n], x^2 + y^2 <= n^2]

%o -- _Reinhard Zumkeller_, Jan 23 2012

%o (PARI) a(n)=my(n2=n^2);sum(a=0,n,sqrtint(n2-a^2)+1) \\ _Charles R Greathouse IV_, Apr 03 2013

%o (Python)

%o from math import isqrt

%o def A000603(n): return (m:=n<<1)+sum(isqrt(k*(m-k)) for k in range(1,n))+1 # _Chai Wah Wu_, Jul 18 2024

%Y Column k=2 of A302998.

%Y Cf. A000328, A036695, A036702, A255238, A255195.

%K nonn

%O 0,2

%A _N. J. A. Sloane_

%E More terms from _David W. Wilson_, May 22 2000