

A372218


a(n) is the number of ways to select three distinct points of an n X n grid forming a triangle whose sides do not pass through a grid point.


3



0, 4, 36, 184, 592, 1828, 4164, 9360, 18592, 34948, 59636, 102096, 161496, 255700, 385292, 562336, 796344, 1131996, 1552780, 2133368, 2855632, 3765492, 4876444, 6328104, 8049744, 10203820, 12766508, 15870744, 19496392, 23984444, 29090340, 35318968, 42535496, 50936036
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,2


COMMENTS

a(n) is 1/6 of the number of ways to select three points (x,y), (u,v), (p,q) with gcd(xu,yv) = gcd(up,vq) = gcd(px,qy) = 1 and 0 <= x, y, u, v, p, q <= n in an n X n grid.


LINKS



EXAMPLE

See the linked illustration: a(2) = 36 because there are 36 ways to select three distinct points in a square grid with side length n that satisfy the condition.


MAPLE

local x, y, u, v, p, q, a;
a:=0;
for x from 0 to n do
for y from 0 to n do
for u from 0 to n do
for v from 0 to n do
if gcd(xu, yv)=1 then
for p from 0 to n do
for q from 0 to n do
if gcd(xp, yq)=1 and gcd(pu, qv)=1 then a:=a+1 fi;
od;
od;
fi;
od;
od;
od;
od;
a:=a/6;
return a;
end proc;


CROSSREFS



KEYWORD

nonn


AUTHOR



STATUS

approved



