login
Number of integer pairs (x,y) such that 1<x<=y<=n and x^2+y^2<=n^2.
3

%I #11 Jun 04 2019 13:05:28

%S 0,1,3,5,9,13,17,23,30,38,45,53,64,74,86,97,110,123,138,154,168,186,

%T 203,220,241,261,282,302,324,348,370,396,421,448,476,501,531,558,591,

%U 622,651,684,717,753,788,821,858,894,933,973,1014,1054,1093,1135

%N Number of integer pairs (x,y) such that 1<x<=y<=n and x^2+y^2<=n^2.

%C For a guide to related sequences, see A211266.

%H Robert Israel, <a href="/A211340/b211340.txt">Table of n, a(n) for n = 1..2000</a>

%p N:= 100: # for a(1)..a(N)

%p V:= Vector(N):

%p for y from 1 to N-1 do

%p for x from 1 to y do

%p r:= x^2 + y^2;

%p if r > N^2 then break fi;

%p t:= ceil(sqrt(r));

%p V[t]:= V[t]+1

%p od od:

%p ListTools:-PartialSums(convert(V,list)); # _Robert Israel_, Jun 04 2019

%t a = 1; b = n; z1 = 120;

%t t[n_] := t[n] = Flatten[Table[x^2 + y^2, {x, a, b - 1}, {y, x, b}]] (* 1<=x<=y<=n *)

%t c[n_, k_] := c[n, k] = Count[t[n], k]

%t TableForm[Table[c[n, k], {n, 1, 7}, {k, 1, n^2}]]

%t Table[c[n, n^2], {n, 1, z1}] (* A046080 *)

%t c1[n_, m_] := c1[n, m] = Sum[c[n, k], {k, a, m}]

%t Table[c1[n, n^2], {n, 1, z1/2}] (* A211340 *)

%Y Cf. A046080, A211266.

%K nonn

%O 1,3

%A _Clark Kimberling_, Apr 08 2012