/* Ramanujan numbers are numbers that can be formed by adding two cubes of integer numbers in two (or more) different ways, i.e. i^3+j^3 = k^3+l^3 See This program counts the Ramanujan numbers up to a given */ #include #include #include #include #include #include struct entry { int k,l; long value; }; int comp_entry(const void *p1, const void *p2) { const struct entry *e1 = p1; const struct entry *e2 = p2; if (e1->value < e2->value) return -1; else return e1->value > e2->value; } long cube(long n) { return n*n*n; } size_t size_table(long n) /* compute a table size that is large enough to keep all I^3+J^3=%ld\n",table_size*sizeof(struct entry)); return 0; usage: fprintf(stderr,"usage: %s \n",argv[0]); exit(1); }