Clock Arithmetic Calculator
Compute modular arithmetic on any clock size: (a op b) mod n.
What is clock arithmetic?
Clock arithmetic is modular arithmetic presented in a very intuitive way. On a normal 12-hour clock, if it is 10 now and you add 5 hours, you do not get 15 o’clock—you wrap around and land on 3. That “wrap-around” behavior is exactly what modulus does.
In math language, you are working mod n, where n is the size of the cycle. For a wall clock, n = 12. For hours in a day, n = 24. For minutes or seconds, n = 60.
The core formula
The calculator on this page evaluates:
where:
- n = clock size (also called modulus)
- a = first number
- b = second number
- op = addition, subtraction, multiplication, or exponentiation
Final results are always normalized to a value from 0 to n − 1.
How to use the calculator
1) Choose your clock size
Set the modulus to match your system. Typical choices are 12, 24, or 60, but any integer 2 or greater works.
2) Enter values and operation
Type in a and b, choose your operation, and click Calculate. Negative numbers are supported for addition, subtraction, and multiplication.
3) Read the normalized answer
The result pane shows the raw arithmetic and the wrapped result. For a 12-hour clock, the calculator also displays the clock-face interpretation where 0 corresponds to 12.
Worked examples
Example A: Addition on a 12-hour clock
(10 + 5) mod 12 = 3
Raw total is 15. Since 15 exceeds 11 in mod 12, subtract 12 once and get 3.
Example B: Subtraction with wrap-around
(2 − 7) mod 12 = 7
Raw result is -5. Add 12 to move into the valid range: -5 + 12 = 7.
Example C: Multiplication mod 24
(9 × 5) mod 24 = 21
Product is 45. Subtract 24 once: 45 - 24 = 21.
Example D: Powers in modular arithmetic
(7^4) mod 12 = 1
7² = 49 ≡ 1 (mod 12), so 7⁴ = (7²)² ≡ 1² = 1.
Why clock arithmetic matters in real life
- Time planning: determine end times after adding hours or minutes.
- Scheduling systems: recurring jobs and cyclic events rely on modular logic.
- Cryptography: many encryption algorithms use modular operations extensively.
- Computer science: hashing, circular buffers, and indexing often wrap around with mod.
- Music and patterns: pitch classes and repeated structures are naturally modular.
Common mistakes to avoid
- Forgetting to normalize: a raw result like 26 on mod 12 must be reduced to 2.
- Confusing 0 and 12 on clock faces: mathematically they are equivalent mod 12.
- Using non-integer modulus: standard clock arithmetic requires integer n ≥ 2.
- Negative exponents: modular powers with negative exponents require multiplicative inverses and extra conditions; this basic calculator limits exponents to non-negative integers.
Quick reference
- (a + b) mod n
- (a − b) mod n
- (a × b) mod n
- (a^b) mod n for b ≥ 0
- Normalize with: ((x mod n) + n) mod n
If you are teaching, learning, or applying modular arithmetic, this tool gives you instant feedback and clear steps. Try different moduli to see how number behavior changes across cycles.