CoursesAIMathCodePhysicsAbout and FAQ

TwiddleLab / Math / Counting and Patterns

Clock Arithmetic: Remainders

Lesson 10 of 11 · 7 min · Free, no account needed

What you will learn

  • On a dial with n spots, only the remainder after dividing by n matters: 100 hours on a 12-hour clock moves the hand 4.
  • We write 100 mod 12 = 4, and say 15 and 3 are the same mod 12. In Python: 100 % 12.
  • Weekdays work mod 7, a Caesar cipher works mod 26.
  • Jumping by 5 round 12 visits every spot; jumping by 4 gets stuck on 0, 4, 8.

Start the lesson

How the lesson goes

  1. It's 9 pm. Your game event starts in 100 hours.

    What time will it be? Drag the hour hand to your bet.

  2. Wind the clock: exactly 15 hours, then exactly 30.

    Drag the hand round clockwise. The counter keeps the total.

  3. Now the hook: 100 hours from 9 pm.

    Wind whole laps while you can, then move the rest.

  4. This is modular arithmetic.

    Divide and keep only the remainder: 100 = 8 × 12 + 4.

    We write 100 mod 12 = 4, and 15 ≡ 3 (mod 12): same spot on the dial. In Python it is 100 % 12.

    Adding and multiplying still work: just wrap round at the end.

  5. Put each number on its spot on a 0 to 11 dial.

    Drag the balls. Laps don't count.

  6. Jump round the dial: 5 spots at a time, from 0.

    Tap where each jump lands. Then the dial finishes the pattern.

  7. Game: what day will it be?

    Today is Monday. Tap the day for each jump. Weeks wrap round mod 7.

  8. A Caesar cipher shifts every letter round the alphabet.

    Turn the inner ring to your own shift, pick a word, then lock your key.

  9. What does this Python line print?

    Four 12s make 48, and 50 - 48 = 2, so 50 % 12 is 2.

  10. Remainders wrap numbers round a dial.

    A message arrived, locked with your key. Turn the ring back to read it.

Previous lesson: Pigeonholes · Next lesson: Project: How Many Passwords? · Part of the course: Counting and Patterns

Lessons are interactive and need JavaScript. Turn it on to play them.

Loading TwiddleLab