Objects/Documentation
rang18.py
Correct a candidate rank · Reproducible Python implementation.
Download ↓"""First-prime factors for every false candidate in a fixed wheel prefix."""
import json
from math import gcd,isqrt,prod
def run(k,level):
if not 1<=k<=5000 or not 1<=level<=4:
raise ValueError("choose k in 1..5000 and wheel level in 1..4")
base=(2,3,5,7)[:level]
mod=prod(base)
bound=16
while True:
divisor=list(range(bound+1))
for p in range(2,isqrt(bound)+1):
if divisor[p]==p:
for z in range(p*p,bound+1,p):