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.

A372915 a(n) is the number of distinct triangles with area n whose vertices are points of an n X n grid.

This page as a plain text file.
%I A372915 #9 Jun 08 2024 03:09:05
%S A372915 0,0,2,4,9,10,25,22,38,49,56,56,111,71,119,141,153,126,249,166,244,
%T A372915 299,279,244,463,288,361,489,517,373,677,436,626,719,620,665,1078,604,
%U A372915 811,936,1000,749,1444,842,1221,1384,1173,1016,1871,1261,1393,1597,1566,1259
%N A372915 a(n) is the number of distinct triangles with area n whose vertices are points of an n X n grid.
%H A372915 Felix Huber, <a href="/A372915/b372915.txt">Table of n, a(n) for n=0..666</a>
%H A372915 Felix Huber, <a href="/A372915/a372915.pdf">Illustration of the term a(4) = 9</a>
%e A372915 See the linked illustration for the term a(4) = 9.
%p A372915 A372915:=proc(n)
%p A372915   local p,q,g,h,u,v,x,y,L,M;
%p A372915   L:=[];
%p A372915   for g from 2 to n do
%p A372915     h:=2*n/g;
%p A372915     if type(h,integer) then
%p A372915       for x to n do
%p A372915         M:=[g,sqrt(x^2+h^2),sqrt((g-x)^2+h^2)];
%p A372915         M:=sort(M);
%p A372915         if not member(M,L) then
%p A372915           L:=[op(L),M];
%p A372915         fi;
%p A372915       od;
%p A372915     fi;
%p A372915   od;
%p A372915   for p to n do
%p A372915     for q from 1 to p do
%p A372915       g:=sqrt(p^2+q^2);
%p A372915       h:=2*n/g;
%p A372915       u:=h/g*q;
%p A372915       v:=q+h/g*p;
%p A372915       for x from max(1,ceil(p/q*(v-n)+u)) to min(n,floor(p/q*v+u)) do
%p A372915         y:=q/p*(u-x)+v;
%p A372915         if type(y,integer) and x <> p and y <> q then
%p A372915           M:=[g,sqrt(x^2+(y-q)^2),sqrt((x-p)^2+y^2)];
%p A372915           M:=sort(M);
%p A372915           if not member(M,L) then
%p A372915             L:=[op(L),M];
%p A372915           fi;
%p A372915         fi;
%p A372915       od;
%p A372915     od;
%p A372915   od;
%p A372915   return numelems(L);
%p A372915 end proc;
%p A372915 seq(A372915(n),n=0..53);
%Y A372915 Cf. A045996, A088658, A303331, A320310, A320542, A320544, A334713, A372217, A372218.
%K A372915 nonn
%O A372915 0,3
%A A372915 _Felix Huber_, Jun 02 2024