Atelier des rouesLab FR
Objects/Documentation

dispersion21.py

I provide the code for this study. Sharing a fixed-buffer sieve

Download ↓
"""Fixed 128-byte sieve buffer, shared versus four independent queries."""
from math import isqrt
import json
from rang19 import primes_to


def scan(offsets):
    base=37813;rank=0;marks=visits=blocks=0;answer=[]
    while rank<offsets[-1]:
        mask=bytearray(128);blocks+=1
        for p in primes_to(isqrt(base+128)):
            start=max(p*p,((base+1+p-1)//p)*p)
            for v in range(start,base+129,p):mask[v-base-1]=1;marks+=1
        for i,val in enumerate(mask,1):
            visits+=1
            if not val:

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.