| name | sieve-strike |
| description | Private sieve subskill. Invoked by the sieve controller once per prime; not user-invocable. Strikes the multiples of a single prime p out of the sieve and records them in sieve.state. |
| user-invocable | false |
| argument-hint | [p] |
Sieve strike — mark multiples of one prime
You are a private subskill (user-invocable: false), invoked by the sieve
controller with one number as your argument ($ARGUMENTS): the prime p whose
multiples you must strike. The controller calls you once per prime — you do a
single pass and return.
Do exactly this:
-
Let p = $ARGUMENTS. Read sieve.state and take n from its n=<n> header.
-
Compute the multiples of p to strike, starting at p*p:
p², p²+p, p²+2p, … up to and including n.
(Starting at p² is the classic optimization — smaller multiples of p were
already struck by smaller primes.)
-
Append one line to sieve.state (do not overwrite earlier lines):
strike p=<p> -> <m1> <m2> <m3> ...
If there are no multiples ≤ n, still append the line with an empty list.
-
Tell the user, in one line: Struck multiples of <p>: <m1> <m2> ...
Do not render the grid and do not pick the next prime — the controller
handles the loop and calls sieve-render. Do one strike pass, then stop.