#include <stdio.h> #include <string.h> #define MAX (1LL<<33) #define WANTED 256 unsigned char *nb = 0; long long a[WANTED]; int main() { nb = new unsigned char[MAX]; memset(nb, 0, MAX*sizeof(*nb)); memset(a, 0, sizeof(a)); for (long long n=1;; n++) { long long p = n*(3*n-1)/2; if (p>=MAX) { break; } else { for (long long m=p; m<MAX; m+=p) { nb[m]++; } } } long long u=1; for (long long n=1; n<MAX; n++) { if (nb[n]<WANTED && a[nb[n]]==0) { a[nb[n]] = n; while (u<WANTED && a[u]) { printf("%lld %lld\n", u, a[u]); fflush(stdout); u++; } } } delete[] nb; return 0; }