Native prime tables #
This fixed program tests every candidate through the supplied bound, writes its primality bit, and counts the primes. Trial division, table addresses, writes and loops are charged. There is no primality oracle or assumed sieve.
Main definitions #
PrimeTable.program: the complete native table builder.PrimeTable.memory: its output bitmap and memory frame.
Main results #
PrimeTable.exec: exact bitmap and prime count in an explicit quadratic instruction bound.
Registers of the trial-division subroutine.
Current trial-division candidate.
Current candidate's primality bit.
Largest candidate.
Output bitmap base.
First candidate not yet written.
Number of primes written.
One past the largest candidate.
Handle zero and one directly; test all larger candidates by charged native trial division.
Test, write the bit, update the count, and advance the candidate.
A finite native prime-table program with its bound and base supplied in registers.
Write every primality bit through m, count exactly Nat.primesLE m, and preserve
all cells outside the bitmap. Trial division gives the explicit quadratic bound
(m+1)(7m+15)+8; the final halt is excluded.