login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Exactly n integer-sided triangles of perimeter a(n) have integer area.
1

%I #21 Jul 02 2022 01:50:58

%S 12,32,48,36,64,98,160,84,128,168,144,108,416,196,192,216,288,256,780,

%T 336,294,612,396,378,1026,392,448,420,512,324,600,792,800,432,484,540,

%U 1000,810,676,576,1760,2842,1250,648,726,924,980,2484,1134,864,1210,784

%N Exactly n integer-sided triangles of perimeter a(n) have integer area.

%H Randall L Rathbun, <a href="/A051519/b051519.txt">Table of n, a(n) for n = 1..229</a>

%o (C)

%o #include <stdio.h> /* printf() */ #include <math.h> /* sqrt() round() */

%o unsigned int is_triangle(int a, int b, int c) { double s,A,B; s = (a+b+c)/2.0; A = s*(s-a)*(s-b)*(s-c); B = floor(sqrt(A)+0.1); if ( B*B == A && A > 0.0 ) return 1; else return 0; }

%o int main() { int set; int a,b,c,p; for (p=1; p<15001; p++) { printf("%d ",p); set = 0; for (a=1; a<p; a++) { for (b=a; b<p; b++) { c = p-a-b; if (c >=b && c < a+b && b < a+c && a < b+c ) { if (is_triangle(a,b,c)) { set += 1; printf("[%d %d %d] ",a,b,c); } } } } printf(" "); printf("perimeter %d = %d ",p,set); } return 0; } /* _Randall L Rathbun_, Jan 26 2007 */

%K nonn

%O 1,1

%A _David W. Wilson_

%E More terms from _Randall L Rathbun_, Jan 26 2007