OFFSET
1,1
COMMENTS
Triangular numbers of the form triangular(x) * triangular(y) * triangular(z), x > y > z > 1.
LINKS
Donovan Johnson, Table of n, a(n) for n = 1..1000
EXAMPLE
378 = 3 * 6 * 21.
630 = 3 * 10 * 21.
990 = 3 * 6 * 55.
PROG
(C)
#include <stdio.h>
typedef unsigned long long U64;
U64 isTriangular(U64 a) { // ! Must be a < (1<<63)
U64 s = sqrt(a*2);
if (a>=(1ULL<<63)) exit(1);
return (s*(s+1)/2 == a);
}
int compare64(const void *p1, const void *p2) {
if (*(U64*)p1 == *(U64*)p2) return 0;
if (*(U64*)p1 < *(U64*)p2) return -1;
return 1;
}
#define TOP (1<<21)
U64 d[TOP];
int main() {
U64 c, x, tx, y, ty, z, tz, p = 0;
for (x = tx = 3; tx <= TOP; tx+=x, ++x) {
for (y = ty = 3; ty < tx; ty+=y, ++y) {
for (z = tz = 3; tz < ty; tz+=z, ++z) {
c = tx*ty*tz;
if (c <= TOP*18 && isTriangular(c)) d[p++] = c;
}}}
qsort(d, p, 8, compare64);
for (x=c=0; c<p; ++c) if ((y=d[c])>x) printf("%llu, ", y), x=y;
return 0;
}
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, May 08 2013
STATUS
approved