[go: up one dir, main page]

login
A226501
Triangular numbers that are the product of 4 distinct triangular numbers greater than 1.
0
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,1
PROG
(C)
#include <stdio.h>
#include <math.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) == 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<TOP*180 && (n*=tw)<TOP*180 && isTriangular(n))
d[p++] = n;
}}}}
qsort(d, p, 8, compare64);
for (x=n=0; n<p; ++n)
if (d[n] > x) x = d[n], printf("%llu, ", x);
return 0;
}
CROSSREFS
Sequence in context: A190319 A296097 A076583 * A046709 A179723 A174825
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Jun 09 2013
STATUS
approved