cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A372217 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.

This page as a plain text file.
%I A372217 #28 Jun 17 2024 15:24:58
%S A372217 0,1,3,8,14,36,48,100,146,232,294,502,595,938,1143,1433,1741,2512,
%T A372217 2826,3911,4458,5319,6067,7976,8728,10750,12076,14194,15671,19510,
%U A372217 20669,25349,28115,31716,34697,39467,41894,49766,54046,59948,63951,74818,78216,90773,97220
%N A372217 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 A372217 Felix Huber, <a href="/A372217/a372217.pdf">Illustration of the terms a(1) to a(6)</a>.
%e A372217 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 A372217 S372217:=proc(n);
%p A372217   local s,x,u,v;
%p A372217   s:=0;
%p A372217   if n=1 then return 1 fi;
%p A372217   for x to n do
%p A372217     if gcd(x,n)=1 then
%p A372217       for u from x to n do
%p A372217         for v from 0 to n do
%p A372217           if gcd(u,v)=1 and gcd(u-x,n-v)=1 then
%p A372217             if u<n then s:=s+1;
%p A372217             elif v>=x then s:=s+1;
%p A372217             fi;
%p A372217           fi;
%p A372217         od;
%p A372217       od;
%p A372217     fi;
%p A372217   od;
%p A372217   return s;
%p A372217 end proc;
%p A372217 A372217:=proc(n)
%p A372217   local i,a;
%p A372217   a:=0;
%p A372217   for i from 0 to n do
%p A372217     a:=a+S372217(i);
%p A372217   od;
%p A372217   return a;
%p A372217 end proc;
%p A372217 seq(A372217(n),n=0..44);
%Y A372217 Cf. A115004, A141224, A141255, A320540, A320541, A320544, A372218.
%K A372217 nonn
%O A372217 0,3
%A A372217 _Felix Huber_, Apr 28 2024