Atelier des rouesLab FR
Objects/Documentation

lots20.py

I provide the code for this calculation. lots20.py

Download ↓
"""Sparse prime queries, pricing index preparation and scan visits separately."""
from math import gcd,isqrt
import json
from rang19 import primes_to


def run(k):
    anchor={100:541,1000:7919,4000:37813}[k]
    requests=(1,8,32,64)
    def segment(length):
        end=anchor+32*length
        marked=bytearray(end-anchor)
        touches=0
        for p in primes_to(isqrt(end)):
            for v in range(max(p*p,((anchor+1+p-1)//p)*p),end+1,p):
                marked[v-anchor-1]=1;touches+=1

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.