OFFSET
1,1
COMMENTS
The area A of a triangle whose sides have lengths a, b, and c is given by Heron's formula: A = sqrt(s*(s-a)*(s-b)*(s-c)), where s = (a+b+c)/2. A given area often corresponds to more than one triangle; for example, a(9) = 60 for the triangles (a,b,c) = (6,25,29), (8,17,15), (13,13,10) and (13,13,24).
LINKS
Giovanni Resta, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Triangle
Wikipedia, Heronian triangle
EXAMPLE
a(3) = 24 because the area of the triangle whose sides are 4, 15, 13 is given by sqrt(p(p-4)(p-15)(p-13)) = 24, where p = (4 + 15 + 13)/2 = 16.
MAPLE
# storage of areas in T(i)
T:=array(1..4000):nn:=100:k:=1:for a from 1
to nn do: for b from 1 to nn do: for c from 1 to nn do: p:=(a+b+c)/2 : x:=p*(p-a)*(p-b)*(p-c): if x>0 then x1:=abs(x):s:=sqrt(x1) :else fi:if s=floor(s) then T[k]:=s:k:=k+1:else
fi:od:od:od:
# sort of T(i)
for jj from 1 to k-1 do: ii:=jj:for k1 from ii+1 to k-1 do:if T[ii]>T[k1] then ii:=k1:else fi:od: m:=T[jj]:T[jj]:=T[ii]:T[ii]:=m:od:liste:=convert(T, set):print(liste):
# second program:
isA188158 := proc(A::integer)
local Asqr, s, a, b, c ;
Asqr := A^2 ;
for s in numtheory[divisors](Asqr) do
if s^2> A then
for a from 1 to s-1 do
if modp(Asqr, s-a) = 0 then
for b from a to s-1 do
c := 2*s-a-b ;
if s*(s-a)*(s-b)*(s-c) = Asqr then
return true ;
end if;
end do:
end if;
end do:
end if;
end do:
false ;
end proc:
for n from 3 to 600 do
if isA188158(n) then
printf("%d, \n", n) ;
end if;
end do: # R. J. Mathar, May 02 2018
MATHEMATICA
nn = 528; lst = {}; Do[s = (a + b + c)/2; If[IntegerQ[s], area2 = s (s - a) (s - b) (s - c); If[0 < area2 <= nn^2 && IntegerQ[Sqrt[area2]], AppendTo[lst, Sqrt[area2]]]], {a, nn}, {b, a}, {c, b}]; Union[lst] (* T. D. Noe, Mar 23 2011 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Mar 22 2011
STATUS
approved