1,000,000,007
1,000,000,007 is the prime most commonly used as a modulus in competitive programming.
- Odd
- Prime
Where 1,000,000,007 fits
Why 1,000,000,007 is special
Chosen for a specific set of reasons rather than for elegance: it is prime, so every non-zero value has a multiplicative inverse; it is just above a billion, so answers stay large enough to be interesting; and twice it still fits in a signed 32-bit integer's successor, so intermediate sums do not overflow a 64-bit accumulator. Problems ask for answers 'modulo 1,000,000,007' so often that the number is recognised on sight.
1,000,000,007 is part of
Factors & digit properties
- Divisors (2)
- 1, 1000000007
- Prime factorisation
- 1000000007
- Digit sum
- 8
- Digital root
- 8
Representations
- Decimal
- 1000000007
- Scientific notation
- 1.000 × 10^9
Roman numerals
Roman numerals as modelled here goes up to 3,999.
Binary
Binary (base 2) as modelled here goes up to 1,000,000,000.
Octal
Octal (base 8) as modelled here goes up to 1,000,000,000.
Hexadecimal
Hexadecimal (base 16) as modelled here goes up to 1,000,000,000.
Other mathematical patterns
- Deficient number
- Safe prime
- Twin prime
Technology & computing
The prime most often used as a modulus in competitive programming is 1,000,000,007. Chosen because it is prime, just under 2³⁰ so products of two residues still fit in a 64-bit integer, and large enough that accidental collisions are rare. Nothing about it is mathematically special; it is a convention that stuck.
DocumentedTechnology & computingGeography: worldwide
About this page's data
Mathematical facts:computed directly from the number's value — nothing to source or verify externally.
Contextual records: 1 reviewer-confirmed record, sourced and reviewed before publication.
Last reviewed: 15 July 2026