A228108 Number of pairs (x, y) with 0 <= x, y <= n such that the distance between two points is a positive integer.
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
Keywords
Links
- David A. Corneth, Table of n, a(n) for n = 1..10560
- Wikipedia, Pythagorean triple
Programs
-
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
Comments