Multiprecision Integer Arithmetic
Arbitrary-Precision Integer Arithmetic
Overview
Integer representation, basic operations, fast multiplication and division, modular arithmetic, GCD, primality testing, factorization, and number-theoretic functions — covered across all 13 chapters.
By Level
-
Introduction (1 chapter)
Introduction to Multiprecision Integers
-
Basic (2 chapters)
Integer representation / Basic operations
-
Intermediate (4 chapters)
Fast multiplication / Fast division / Modular arithmetic / Integer GCD
-
Advanced (6 chapters)
Unbalanced Toom-Cook / NTT comparison / Primality testing / Integer factorization / Block Lanczos / Number-theoretic functions
All Chapters
Introduction (1 chapter)
-
Chapter 1
Introduction to Multiprecision Integers
The 64-bit wall, use cases for multiprecision integers, representation choices, memory management, overview of major libraries
Basic (2 chapters)
-
Chapter 2
Multiprecision Integer Representation
Limb arrays, sign-magnitude vs two's complement, endianness, SBO, calx design choices
-
Chapter 3
Basic Integer Operations
Schoolbook add/subtract/multiply/divide, carry propagation, comparison, string conversion
Intermediate (4 chapters)
-
Chapter 4
Fast Multiplication Algorithms
Karatsuba, Toom-Cook 3/4/6/8, NTT, 5-smooth NTT, squaring optimization, threshold design
-
Chapter 5
Fast Division Algorithms
Knuth's Algorithm D, Burnikel-Ziegler, Newton reciprocal iteration, Exact Division, calx implementation
-
Chapter 6
Modular Arithmetic
Barrett reduction, Montgomery multiplication, CRT, fast modular exponentiation, constant-time implementations
-
Chapter 7
Integer GCD Algorithms
Classical Euclid, Binary GCD (Stein), Lehmer, HGCD, Extended GCD, modular inverse
Advanced (6 chapters)
-
Chapter 8
Unbalanced Toom-Cook Multiplication
Toom-4,2 / Toom-8, pre-pad + addmul_1, application to unbalanced invert_approx
-
Chapter 9
NTT Implementation Comparison
Prime NTT, Small Prime NTT, Goldilocks NTT, Double FFT, 5-smooth NTT, AVX2 butterflies
-
Chapter 10
Primality Testing
Miller-Rabin, Fermat, Baillie-PSW, APRCL, AKS, practical combined strategies
-
Chapter 11
Integer Factorization
Trial division, Pollard rho/Brent, Pollard p-1, Fermat, ECM, SIQS, GNFS
-
Chapter 12
Block Lanczos
GF(2) sparse matrix solver, Coppersmith blocking, CSR format, final stage of GNFS
-
Chapter 13
Number-Theoretic Functions
Möbius μ, Euler totient φ, divisor functions σ_k, Jacobi symbol, Dirichlet convolution, Möbius inversion
Last updated: 2026-04-20