Numberwise

1,000,000,007

1,000,000,007 is the prime most commonly used as a modulus in competitive programming.

1 confirmed record · 1 sourceChecked and sourcedHow we qualify claimsReport a correction

Where 1,000,000,007 fits

Where 1,000,000,007 fits: MathematicsMathematics: Prime, Safe prime, Twin prime.MathematicsPrimeSafe primeTwin prime1,000,000,007
1,000,000,007 connects to 1 world: mathematics.

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

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