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”).

A051519
Exactly n integer-sided triangles of perimeter a(n) have integer area.
1
12, 32, 48, 36, 64, 98, 160, 84, 128, 168, 144, 108, 416, 196, 192, 216, 288, 256, 780, 336, 294, 612, 396, 378, 1026, 392, 448, 420, 512, 324, 600, 792, 800, 432, 484, 540, 1000, 810, 676, 576, 1760, 2842, 1250, 648, 726, 924, 980, 2484, 1134, 864, 1210, 784
OFFSET
1,1
LINKS
PROG
(C)
#include <stdio.h> /* printf() */ #include <math.h> /* sqrt() round() */
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; }
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 */
CROSSREFS
Sequence in context: A118785 A071336 A248817 * A305074 A166959 A134582
KEYWORD
nonn
EXTENSIONS
More terms from Randall L Rathbun, Jan 26 2007
STATUS
approved