Atelier des rouesLab FR
Applications/Indexing

Indexing rare periodic events

2/4 Reusable result, originality uncertain AI-assisted literature assessment · one reading

I isolate a reusable fragment: for every even modulus, the two reflection axes lie inside exactly two gaps of the reduced-residue cycle, which lets the algorithm fold symmetric addresses. Holt and Rudd study gap cycles at primorial sieve stages; this note extends the fixed-gap count to arbitrary even moduli. That could help enumerate periodic schedules, but calendar symmetry is untested, and the small checks do not establish an end-to-end speedup; preparation and query costs still need comparison.

Fred B. Holt and Helgi Rudd, Eratosthenes sieve and the gaps between primes · Sebastiano Vigna, Quasi-Succinct Indices

How I rate results

I use a symmetry of the constraints to generate one representative per orbit.

Use case

An index of periodic availability can combine several modular calendars. If the requested pattern is reflection-invariant, one address determines its partner. My prototype implements the precise model of sieve-wheel gaps. A calendar application would first have to verify the same symmetry of availability constraints.

Algorithmic contribution

I refine a stable fibre until the first wheel where the two residues differ and expand one side. In period 210, gap 2 has 15 starts including one fixed point, so eight representatives suffice. The program compares every sorted address against exhaustive cycles in 108 cases.

Next step

I will compare recursive folding to single-base folding, measuring preparation, descents and sorting separately. Minimising representative count can increase preparation cost. The proposed practical benefit would fail if this dominates on the target workloads.

On the wheel of period 210, gaps two and four each have one start fixed by reflection. For gaps six and ten all starts form pairs.

On the wheel of period 210, gaps two and four each have one start fixed by reflection. For gaps six and ten all starts form pairs.

Reproducing the example

After extracting the files, I run python experience.py (Python 3.10+). The file resultats.json contains the reference output.

Prior work

Holt & Rudd · Holt

Two reflection centres for every even period

For the units of any even modulus R ≥ 4 I can give the fixed-start count J before traversal. A gap of length g starting at x is fixed when 2x+g ≡ 0 modulo R. Its midpoint lies on one of two axes on the circle, 0 or R/2. At zero the nearest units are −1 and 1. If 4 divides R then R/2±1 are odd and coprime to R. If R ≡ 2 modulo 4, R/2 is odd and greater than one, R/2±1 are even, and R/2±2 are coprime to R. Each axis therefore lies inside a unique gap. These are the only fixed gaps. There are two of length two if 4 divides R, and one of length two and one of length four otherwise.

Symmetry and central gaps of primorial wheels appear in Holt and Rudd. I reuse that observation in the AT.M2 count (T+J)/2 and give the argument here for every even R ≥ 4. I checked every even period from 4 to 500. Holt and Rudd, remark 2.2 · AT.M3

Control from XII

I independently sieve 48,210,750 ticks and check the gap of 30 at the XII address. Absolute rank remains conditional on the supplied anchor prefix. I run python adresse43.py and compare with controle-xii.json.

Reducing the byte size of partial-address lists

I sort partial addresses by signature and combine Elias–Fano with raw encoding of small groups. At 37, XIV reports 3,327,296 payload bytes versus 5,539,528. Resident memory rises from 55,992 to 58,044 KiB and queries slow down. I checked 5,120 exact accesses across 1,023 lists.

I run python temoin_xiv.py to replay my local check and keep its output in controle-xiv.json. Reducing the byte size of partial-address lists · Vigna, Quasi-Succinct Indices

What does a delta index cost?

I generate all 640 positions of (0,2,6) in one period of 30,030. A 16-bit array takes 1,280 bytes. With variable-length deltas and two 16-bit words per anchor, I go from 890 bytes and at most seven decodes (blocks of 8) to 680 bytes and 63 decodes (blocks of 64). I verify all 30,030 prefix queries.

My next test is to choose block sizes on held-out queries and include all metadata. AT.IDX1 · Vigna, Quasi-Succinct Indices

I run python blocs09.py.

The cost of a prefix in four representations

I verify every prefix of a 30,030-position universe containing 640 marks. Including format headers and anchors, I obtain 852 bytes for blocks of 16, 782 for adaptive blocks, 702 for blocks of 64 and 601 for Elias–Fano. My direct Elias–Fano reader is the slowest on this workload. A two-block cache produces five hits and five misses, checked against explicit positions. The byte counts measure serialised payloads.

I plan to add a select directory to Elias–Fano and measure its space and cold-query latency together. AT.IDX2 · Vigna, Quasi-Succinct Indices

I run python index10.py.

Accounting for the selection directory

I recover all 30,030 prefixes with strides 8, 32 and 64. Serialised sizes rise from 601 bytes to 763, 643 and 623. Across seven requests my implicit two-block cache fallback emits 800 positions on five misses.

Measure end-to-end cost with dispersed queries and preprocessing. AT.IDX3 · Vigna, Quasi-Succinct Indices

I can reproduce the select timings with python repertoire11.py --measure. The seven passes time in-memory queries after construction. The file mesures-select11.json records one run on the machine used for the assessment.

Checking the level-47 threshold in independent segments

I fix four 65,536-tick segments around floor(R/3). I also compare 256 selects to an independent packed bit vector. I count 12,14,9,9 starts of gap 30 by two methods. The full prefix would need 3,127,491,163,069 segments of this size. On the reduced 30,030-position index the directory uses 763 bytes and the bitarray vector 3,754. The latter wins this microbenchmark. A two-block cache misses 267 of 288 dispersed queries.

I will compare two full algebraic splits under a fixed space budget. AT.IDX4 · Schnell, bitarray

I run python segments12.py for exact checks. With bitarray 3.12.5, python segments12.py --measure compares construction and selection costs for the same ranks.

Two partitions of the same level-47 prefix

I count starts of gaps of 30 in [0,131072) at level 47. I find 16 starts by marking and by two disjoint sums over 8 classes modulo 30 and 48 modulo 210. The full one-third prefix reported in XX.A01 requires computation on another scale.

Compare outputs and complete costs for both indices at the same level-47 threshold. AT.IDX5 · Schnell, bitarray

Download bilingual starter kit ↓

Comments

Comments from both language editions appear here.

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