#include <stdio.h>
#include <stdlib.h>
#include "primes.h"

int main(int argc, char **argv) 
{
    int start = atoi(argv[1]);
    int end = atoi(argv[2]);
    srand(atoi(argv[3]));

    for (int i = start; i <= end; i++) 
    {
        char fn[32];
        sprintf(fn, "%02d", i);
        freopen(fn, "w", stdout);
        __int64 lim = 1000000000000000000LL;
        __int64 v = 1;
        for (int i = 0; v <= lim && i < 100; i++) 
        {
            __int64 cur = lim / v;
            int m = rand() % primecount;
            int cnt = 0;
            while (cur >= primes[m]) 
            {
                cnt++;
                cur /= primes[m];
            }
            if (cnt > 0) 
            {
                int mul = rand() % cnt;
                for (int j = 0; j < mul; j++) 
                {
                    v *= primes[m];
                }
            }
        }
        printf("%I64d\n", v);
    }
    return 0;
}