Fast Start or Fast Repeat? Binomial Coefficients Modulo a Prime for N up to 10^18

Evaluating binomial coefficients C(N, R) mod p when N reaches 10^18 and p < 2^31 is large enough to defeat linear O(p) precomputation forces an uncomfortable engineering choice between startup latency and query throughput. We investigate this tradeoff empirically by building and auditing two prime-modulus (k = 1) factorial backends inside a shared C++17 arithmetic pipeline. Compact, a square-root-block engine built for fast startup and tight RAM, uses a median peak working set of 5.9 MB and a 6.2 ms first-query latency across all 48 expensive benchmark cases. Warm—a dense-block engine tuned for heavy reuse—uses 7.0 MB and 22.6 ms, whereas Stock Suisen requires 18.0 MB and 56.4 ms. Against Stock Suisen, Warm achieves equal-case geometric-mean speedups of 2.141x on cold batches (48/48 wins) and 2.262x on warm batches (47/48 wins), while beating Compact on warm batches by 12.137x. On cold batches where construction cost cannot be amortized, Compact beats Warm in 44 of 48 expensive cases; Frozen Nyaan wins 26/48, and Balanced Suisen wins 31/48. Control-case regressions are reported alongside these wins without omission. Companion C++17 library (MIT License), exact-reference tests (319,910 checks per compiler on GCC and Clang), and supplementary audit tables: https://github.com/Vadik-x/prime-modulus-binomial-tradeoff

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-22
DOI
https://doi.org/10.5281/zenodo.24434288
Primary Topic
Cryptography and Residue Arithmetic
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Fast Start or Fast Repeat? Binomial Coefficients Modulo a Prime for N up to 10^18

Vadik Malik
Zenodo (CERN European Organization for Nuclear Research)
Cryptography and Residue Arithmetic
preprint

Fast Start or Fast Repeat? Binomial Coefficients Modulo a Prime for N up to 10^18

Vadik Malik
preprint en

Abstract

Evaluating binomial coefficients C(N, R) mod p when N reaches 10^18 and p < 2^31 is large enough to defeat linear O(p) precomputation forces an uncomfortable engineering choice between startup latency and query throughput. We investigate this tradeoff empirically by building and auditing two prime-modulus (k = 1) factorial backends inside a shared C++17 arithmetic pipeline. Compact, a square-root-block engine built for fast startup and tight RAM, uses a median peak working set of 5.9 MB and a 6.2 ms first-query latency across all 48 expensive benchmark cases. Warm—a dense-block engine tuned for heavy reuse—uses 7.0 MB and 22.6 ms, whereas Stock Suisen requires 18.0 MB and 56.4 ms. Against Stock Suisen, Warm achieves equal-case geometric-mean speedups of 2.141x on cold batches (48/48 wins) and 2.262x on warm batches (47/48 wins), while beating Compact on warm batches by 12.137x. On cold batches where construction cost cannot be amortized, Compact beats Warm in 44 of 48 expensive cases; Frozen Nyaan wins 26/48, and Balanced Suisen wins 31/48. Control-case regressions are reported alongside these wins without omission. Companion C++17 library (MIT License), exact-reference tests (319,910 checks per compiler on GCC and Clang), and supplementary audit tables: https://github.com/Vadik-x/prime-modulus-binomial-tradeoff

Zenodo (CERN European Organization for Nuclear Research)
Cryptography and Residue Arithmetic
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon
Fast Start or Fast Repeat? Binomial Coefficients Modulo a Prime for N up to 10^18 — Vadik Malik · Zenodo (CERN European Organization for Nuclear Research) (2026) | TGRS Research Map | TGRS