OFFSET
1,1
COMMENTS
Equivalent to finding all integer triples (a,b,c) such that sqrt(4*a*b-(a+b-c)^2) is an integer multiple of 4.
All Pythagorean triples satisfy this criterion; if (a,b,c) is a Pythagorean triple then a and b cannot be odd, so the triangle has integer area.
If m is in the list, so is 4m.
LINKS
Samuel Bodansky, Table of n, a(n) for n = 1..100
EXAMPLE
The triangle with side lengths sqrt(8), sqrt(9) and sqrt(29) has area 3 and is not a right triangle, so 29 is in the list.
The triangle with side lengths sqrt(53), sqrt(65) and sqrt(72) has area 27 and is not a right triangle, so 72 is in the list.
MATHEMATICA
ok[c_] := Catch[ Do[ If[ a+b != c && 4 a b > (c-a-b)^2 && IntegerQ[ Sqrt[2 a (b+c) - a^2 - (b-c)^2]/4], Throw@ True], {a, c}, {b, a}]; False]; Select[ Range@ 96, ok] (* Giovanni Resta, May 13 2020 *)
PROG
(Python)
import numpy as np
import math
def is_square(n):
return math.isqrt(n) ** 2 == n
def is_valid_triangle(a, b, c):
return ((a + b) > c) and ((b + c) > a) and ((a + c) > b)
def aList(upto): # Number to check up to
my_list = []
for i in range(upto):
sqrti = np.sqrt(i)
for j in range(i + 1):
sqrtj = np.sqrt(j)
for k in range(i + 1):
sqrtk = np.sqrt(k)
if is_valid_triangle(sqrti, sqrtj, sqrtk):
test = 4 * i * j - (i + j - k) ** 2
if is_square(test) and test % 16 == 0 and (i != j + k):
my_list.append(i)
return list(set(my_list))
print(aList(103))
CROSSREFS
KEYWORD
nonn
AUTHOR
Samuel Bodansky, May 12 2020
STATUS
approved