login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) is the number of distinct triangles whose sides do not pass through a grid point and whose vertices are three points of an n X n grid.
3

%I #28 Jun 17 2024 15:24:58

%S 0,1,3,8,14,36,48,100,146,232,294,502,595,938,1143,1433,1741,2512,

%T 2826,3911,4458,5319,6067,7976,8728,10750,12076,14194,15671,19510,

%U 20669,25349,28115,31716,34697,39467,41894,49766,54046,59948,63951,74818,78216,90773,97220

%N a(n) is the number of distinct triangles whose sides do not pass through a grid point and whose vertices are three points of an n X n grid.

%H Felix Huber, <a href="/A372217/a372217.pdf">Illustration of the terms a(1) to a(6)</a>.

%e See the linked illustration for the terms a(1) = 1, a(2) = 3, a(3) = 8, a(4) = 14, a(5) = 36 and a(6) = 48.

%p S372217:=proc(n);

%p local s,x,u,v;

%p s:=0;

%p if n=1 then return 1 fi;

%p for x to n do

%p if gcd(x,n)=1 then

%p for u from x to n do

%p for v from 0 to n do

%p if gcd(u,v)=1 and gcd(u-x,n-v)=1 then

%p if u<n then s:=s+1;

%p elif v>=x then s:=s+1;

%p fi;

%p fi;

%p od;

%p od;

%p fi;

%p od;

%p return s;

%p end proc;

%p A372217:=proc(n)

%p local i,a;

%p a:=0;

%p for i from 0 to n do

%p a:=a+S372217(i);

%p od;

%p return a;

%p end proc;

%p seq(A372217(n),n=0..44);

%Y Cf. A115004, A141224, A141255, A320540, A320541, A320544, A372218.

%K nonn

%O 0,3

%A _Felix Huber_, Apr 28 2024