login
A228108
Number of pairs (x, y) with 0 <= x, y <= n such that the distance between two points is a positive integer.
2
4, 18, 48, 108, 204, 342, 528, 780, 1100, 1494, 1968, 2576, 3292, 4122, 5104, 6240, 7524, 8962, 10560, 12348, 14324, 16494, 18864, 21600, 24572, 27786, 31248, 34996, 39012, 43362, 48000, 52968, 58244, 63834, 69840, 76308, 83132, 90318, 97872, 105972, 114468, 123378, 132704, 142500, 152892, 163742, 175056
OFFSET
1,1
COMMENTS
Pairs ((0, 1), (0, 0)) and ((0, 0), (0, 1)) are considered equal since they have the same points. ((0, 0), (0, 0)) isn't counted the distance between the points included isn't a positive integer. The x's and y's of points in a pair may differ due to Pythagoras, for example ((0, 0), (3, 4)).
LINKS
PROG
(PARI) a(n)=my(tot=n*(n+1)^2); forstep(i=1, sqrt(ceil(sqrt(n))^2)*(1+sqrt(2))\1, 2, forstep(j=2, max(sqrt(ceil(sqrt(n+i^2))^2)\1, n\(2*i))*(1+sqrt(2))\1, 2, if(gcd(i, j)==1, for(k=1, n\max(2*i*j, abs(j^2-i^2)),
tot+=(n-2*i*j*k+1)*(n-abs(j^2-i^2)*k+1)*4)))); tot \\David A. Corneth
CROSSREFS
Sequence in context: A163188 A114364 A045991 * A259451 A181860 A027271
KEYWORD
nonn
AUTHOR
David A. Corneth, Aug 10 2013
STATUS
approved