2^100 mod 7 is 2 in arithmetic and 0 on a machine that keeps 53 bits

The remainder is computed on a rounded quotient, so the answer to the largest step is the honest demonstration of the limit.

Arithmetic and functions · Level: Exam and contest · Updated on 2026-11-10

The number 2^100 is 1267650600228229401496703205376, thirty-one digits, and the screen prints it as 1.2676506002282⋅10+30. Ask for 2^100 mod 7 in the same window and the answer is 0. Ask for 2^4 mod 7 and it is 2 — which is the correct one: 2^3 = 8 ≡ 1 (mod 7), so 2^99 ≡ 1 and 2^100 ≡ 2, or equivalently 2^6 ≡ 1 and 100 mod 6 = 4 reduce the whole question to 2^4 mod 7.

Nothing about the power is wrong; the remainder is. A double stores fifty-three bits, so the nearest representable value to 2^100/7 is off by roughly 10^13, and a remainder computed as a − 7·floor(a/7) inherits an error far larger than the modulus. The correct method never lets the number grow: reduce first, then raise, which is exactly what modular exponentiation does in every cryptographic library, and why RSA can work with thousand-bit numbers on hardware that stores fifty-three. This is the same ceiling that makes 2^53 the last exact integer counter.

Answer

0

How to read it

2^100 mod 7 on the workbench — the machine's answer, not the arithmetic one. The second link is 2^6 mod 7 = 1, the period; the third is the reduced question 2^4 mod 7 = 2, which is the true value.

Source

2^100 = 1267650600228229401496703205376 is exact in binary floating point, being a power of two, but the quotient by 7 has thirty significant digits and IEEE-754 binary64 carries only about sixteen, so a mod implemented as a − b·floor(a/b) returns a remainder taken from the rounded quotient

Work it in the calculator

These links open the right calculator with this problem's numbers already typed in. The line above is what the screen should show — check it yourself.

This is an independent third-party tool site. It is not affiliated with, sponsored by, or authorised by Casio, Texas Instruments or their distributors. Model names and product names are trademarks of their respective owners and appear here only to identify devices.

The keystroke sequences in these manuals were written from this site's own layout data — the same data the online calculator renders — plus publicly available product facts. Specifications and regional configurations are confirmed against the physical device and the manufacturer's most recent material.