A226501 Triangular numbers that are the product of 4 distinct triangular numbers greater than 1.
25200, 97020, 145530, 499500, 673380, 749700, 839160, 1185030, 1445850, 1786995, 1873080, 2031120, 2049300, 2162160, 2821500, 3444000, 3646350, 4250070, 4573800, 4915680, 4991220, 5364450, 5512860, 6193440, 11594520, 11763675, 12748725, 13857480, 14340690, 15481830
Offset: 1
Keywords
Programs
-
C
#include
#include 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) == a*2); } int compare64(const void *p1, const void *p2) { if (*(U64*)p1 == *(U64*)p2) return 0; return (*(U64*)p1 < *(U64*)p2) ? -1 : 1; } #define TOP (1ULL<<19) U64 d[TOP]; int main() { U64 n, x, tx, y, ty, z, tz, w, tw, 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) { for (w = tw = 3; tw < tz; tw+=w, ++w) { n = tx*ty*tz; if (n x) x = d[n], printf("%llu, ", x); return 0; }