OEIS/A070080
Triangles with integer sides, areas and in-radii
List of Reinhard Zumkeller
(Reinhard was my colleague in April 1976 at the University of Dortmund and at Softlab GmbH in München.)
- Java program (for the jOEIS environment) that reproduces the list, with the area and in-radius values in addition.
- Perl program with identical output:
#!perl # @(#) $Id$ # Generate integer-sided triangles # 2024-04-05, Georg Fischer # #:# Usage: #:# perl A070080_gen.pl [start [[-]end]] #:# start first perimeter (default 1) #:# +end number of perimeters to be printed (default 1, or 55 if start=1) #:# -end print from perimeter start to abs(end) #-------- use strict; # do not use integer! b.o. area and inradius use warnings; my $periStart = 1; my $periEnd = 55; my $debug = 0; while (scalar(@ARGV) > 0 and ($ARGV[0] =~ m{\A[\-\+]})) { my $opt = shift(@ARGV); if (0) { } elsif ($opt =~ m{d}) { $debug = shift(@ARGV); } } # while if (scalar(@ARGV) > 0) { $periStart = shift(@ARGV); } if (scalar(@ARGV) > 0) { $periEnd = shift(@ARGV); } else { if ($periStart > 1) { $periEnd = $periStart; } } my ($peri, $a, $b, $c, $r) = (1, 1, 0, 2, 0); $peri = $periStart; $a = 1; $b = 0; if ($periStart > 1) { &printSeparator(); } my $n = 0; my $oldPeri = $peri; while ($peri <= $periEnd) { $n ++; &advance(); if ($peri != $oldPeri) { &printSeparator(); $oldPeri = $peri; } if ($peri <= $periEnd) { print sprintf("| %5d | %5d |%4d%4d%4d |", $n, $peri, $a, $b, $c); print sprintf("%6d |%6d |", &gcd($a, &gcd($b, $c)), $a**2 + $b**2 - $c**2); my $s = $peri/2; my $H = sprintf("%12.6f", sqrt($s*($s - $a)*($s - $b)*($s - $c))); my $I = sprintf( "%8.6f", sqrt( ($s - $a)*($s - $b)*($s - $c)/$s)); print " s" if $a < $b && $b < $c; print " i" if $a == $b || $b == $c; if (0) { } elsif (&isPrime($a) && &isPrime($b) && &isPrime($c)) { print " p"; } elsif (&gcd($a, &gcd($b, $c)) == 1) { print " r"; } else { print " "; } print " A" if $a**2 + $b**2 > $c**2; print " R" if $a**2 + $b**2 == $c**2; print " O" if $a**2 + $b**2 < $c**2; print "" . (($H =~ m{\.000000}) ? " H" : " "); print "" . (($I =~ m{\.000000}) ? " I" : " "); print " | $H $I"; print "\n"; } } # for $n #---- sub printSeparator { print "+-------+-------+-------------+-------+-------+-----------+\n"; } sub advance { my $busy = 1; while ($busy) { $b ++; $c = $peri - $a - $b; print sprintf("%3d: %3d %3d %3d P\n", $peri, $a, $b, $c) if $debug > 0; if ($a <= $b and $b <= $c && $a + $b > $c) { $busy = 0; } elsif ($b > $c) { $a ++; $r = $peri - $a; $b = $a; $c = $peri - $a - $b; print sprintf("%3d: %3d %3d %3d Q\n", $peri, $a, $b, $c) if $debug > 0; if ($a <= $b and $b <= $c && $a + $b > $c) { $busy = 0; } elsif ($b + $c <= $a) { $peri ++; $a = 1; $r = $peri - $a; $b = $a; $c = $peri - $a - $b; print sprintf("%3d: %3d %3d %3d R\n", $peri, $a, $b, $c) if $debug > 0; if ($a <= $b and $b <= $c && $a + $b > $c) { $busy = 0; } } } } # while } # advance # from https://gist.github.com/EricCrosson/8b5dc6a15679f159f7fc sub gcd { my ($m, $n) = @_; if ($n == 0) { return $m; } return gcd($n, $m % $n); } # https://stackoverflow.com/questions/32675465/perl-finding-out-if-a-given-number-is-a-prime-number sub isPrime { my ($num) = @_; # 1 1 1 1 1 1 1 1 1 1 2 # 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 my @pc = (0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1); return $pc[$num] if $num < scalar(@pc); return 0 if $num % 2 == 0 ; for (my $i = 3; $i <= $num/2; $i += 2) { return 0 if ($num % $i == 0) } return 1; } __DATA__ s = scalene: a < b < c | | i = isosceles: a = b or b = c | | | | r = a, b, and c are relatively prime | | p = a, b, and c are primes (p < r) | | | | A = acute: a^2 + b^2 > c^2 | | R = right: a^2 + b^2 = c^2 | | O = obtuse: a^2 + b^2 < c^2 | +-----+-------+----------+-------+-------+-----------------+ |Sequ-|A070083|A070080-82|A070084|A070085| | | Nr. | a+b+c | a b c | gcd | | properties | +-----+-------+----------+-------+-------+-----------------+ | 1 | 3 | 1 1 1 | 1 | 1 | i r A | |- - - - - - - - - - - - - - - - - - - -| | 2 | 5 | 1 2 2 | 1 | 1 | i r A | |- - - - - - - - - - - - - - - - - - - -| | 3 | 6 | 2 2 2 | 2 | 4 | i p A | |
A070080 SIDE_A s -> isTriangle(s) Smallest side of integer triangles [a(n) <= A070081(n) <= A070082(n)], sorted by perimeter, lexicographically ordered. A070081 SIDE_B s -> isTriangle(s) Middle side of integer triangles [A070080(n) <= a(n) <= A070082(n)], sorted by perimeter, sides lexicographically ordered. A070082 SIDE_C s -> isTriangle(s) Largest side of integer triangles [A070080(n) <= A070081(n) <= a(n)], sorted by perimeter, sides lexicographically ordered. A070083 PERIMETER s -> isTriangle(s) Perimeters of integer triangles, sorted by perimeter, sides lexicographically ordered. A070084 GCD s -> isTriangle(s) Greatest common divisor of sides of integer triangles [A070080(n), A070081(n), A070082(n)], sorted by perimeter, sides lexicographically ordered. A070085 SHAPE s -> isTriangle(s) a(n) = A070080(n)^2 + A070081(n)^2 - A070082(n)^2. A070086 AREA s -> isTriangle(s) Areas of integer triangles [A070080(n), A070081(n), A070082(n)], rounded values. A070088 COUNT s -> hasPrimeSides(s) Number of integer-sided triangles with perimeter n and prime sides. A070090 COUNT s -> isScalene(s) && hasPrimeSides(s) A070091 COUNT s -> isIsosceles(s) && hasCoPrimeSides(s) A070092 COUNT s -> isIsosceles(s) && hasPrimeSides(s) A070093 COUNT s -> isAcute(s) A070094 COUNT s -> isAcute(s) && hasCoPrimeSides(s) A070095 COUNT s -> isAcute(s) && hasPrimeSides(s) A070096 COUNT s -> isAcute(s) && isScalene(s) && hasCoPrimeSides(s) A070097 COUNT s -> isAcute(s) && isScalene(s) && hasPrimeSides(s) A070098 COUNT s -> isAcute(s) && isIsosceles(s) A070099 COUNT s -> isAcute(s) && isIsosceles(s) && hasCoPrimeSides(s) A070100 COUNT s -> isAcute(s) && isIsosceles(s) && hasPrimeSides(s) A070101 COUNT s -> isObtuse(s) A070102 COUNT s -> isObtuse(s) && hasCoPrimeSides(s) A070103 COUNT s -> isObtuse(s) && hasPrimeSides(s) A070104 COUNT s -> isObtuse(s) && isScalene(s) && hasCoPrimeSides(s) A070105 COUNT s -> isObtuse(s) && isScalene(s) && hasPrimeSides(s) A070106 COUNT s -> isObtuse(s) && isIsosceles(s) A070107 COUNT s -> isObtuse(s) && isIsosceles(s) && hasCoPrimeSides(s) A070108 COUNT s -> isObtuse(s) && isIsosceles(s) && hasPrimeSides(s) A070109 COUNT s -> isRight(s) && hasCoPrimeSides(s) A070110 INDEX s -> hasCoPrimeSides(s) A070111 INDEX s -> hasPrimeSides(s) A070112 INDEX s -> isScalene(s) A070113 INDEX s -> isScalene(s) && hasCoPrimeSides(s) A070114 INDEX s -> isScalene(s) && hasPrimeSides(s) A070115 INDEX s -> isIsosceles(s) A070116 INDEX s -> isIsosceles(s) && hasCoPrimeSides(s) A070117 INDEX s -> isIsosceles(s) && hasPrimeSides(s) A070118 INDEX s -> isAcute(s) A070119 INDEX s -> isAcute(s) && hasCoPrimeSides(s) A070120 INDEX s -> isAcute(s) && hasPrimeSides(s) A070121 INDEX s -> isAcute(s) && isScalene(s) A070122 INDEX s -> isAcute(s) && isScalene(s) && hasCoPrimeSides(s) A070123 INDEX s -> isAcute(s) && isScalene(s) && hasPrimeSides(s) A070124 INDEX s -> isAcute(s) && isIsosceles(s) A070125 INDEX s -> isAcute(s) && isIsosceles(s) && hasCoPrimeSides(s) A070126 INDEX s -> isAcute(s) && isIsosceles(s) && hasPrimeSides(s) A070127 INDEX s -> isObtuse(s) A070128 INDEX s -> isObtuse(s) && hasCoPrimeSides(s) A070129 INDEX s -> isObtuse(s) && hasPrimeSides(s) A070130 INDEX s -> isObtuse(s) && isScalene(s) A070131 INDEX s -> isObtuse(s) && isScalene(s) && hasCoPrimeSides(s) A070132 INDEX s -> isObtuse(s) && isScalene(s) && hasPrimeSides(s) A070133 INDEX s -> isObtuse(s) && isIsosceles(s) A070134 INDEX s -> isObtuse(s) && isIsosceles(s) && hasCoPrimeSides(s) A070135 INDEX s -> isObtuse(s) && isIsosceles(s) && hasPrimeSides(s) A070136 INDEX s -> isRight(s) A070137 INDEX s -> isRight(s) && hasCoPrimeSides(s) A070138 COUNT s -> hasCoPrimeSides(s) && hasIntArea(s) A070139 COUNT s -> isIsosceles(s) && hasIntArea(s) A070140 COUNT s -> isAcute(s) && hasIntArea(s) A070141 COUNT s -> isObtuse(s) && hasIntArea(s) A070142 INDEX s -> hasIntArea(s) A070143 INDEX s -> hasCoPrimeSides(s) && hasIntArea(s) A070144 INDEX s -> isScalene(s) && hasIntArea(s) A070145 INDEX s -> isIsosceles(s) && hasIntArea(s) A070146 INDEX s -> isAcute(s) && hasIntArea(s) A070147 INDEX s -> isObtuse(s) && hasIntArea(s) A070148 INDEX s -> hasTrigonalArea(s) A070149 AREA s -> hasIntArea(s) A070200 INRAD s -> isTriangle(s) A070201 COUNT s -> hasIntInRadius(s) A070202 COUNT s -> !hasCoPrimeSides(s) && hasIntInRadius(s) A070203 COUNT s -> isScalene(s) && hasIntInRadius(s) A070204 COUNT s -> isIsosceles(s) && hasIntInRadius(s) A070205 COUNT s -> isAcute(s) && hasIntInRadius(s) A070206 COUNT s -> isObtuse(s) && hasIntInRadius(s) A070208 COUNT s -> hasIntArea(s) && !hasIntInRadius(s) A070209 INDEX s -> hasIntInRadius(s) A070210 INRAD s -> hasIntInRadius(s) A051493 COUNT s -> hasCoPrimeSides(s) A051516 COUNT s -> hasIntArea(s) A059169 COUNT s -> isIsosceles(s) A070150 filter 1 new A070149() TRIANGULAR Triangular areas of integer Heronian triangles. A070151 tuptraf 1 (n, s) -> s[0].*(s[1])./(2) "" new A002330().skip(1), new A002331().skip(1) A135622 parmof3 1 A070080 SQUARE16 s -> isTriangle(s) 16*Area^2 of integer triangles.