T TestsWorld
Lesson 1 of 11 Square numbers and patterns ⏱ 5 min

The locker puzzle

🤔
Think first
100 people flip 100 lockers. Can you know which stay open without doing it?
🎯 In this lesson you'll learn
  • ✓See why a locker's toggles equal its number of factors
  • ✓Explain why only squares have an odd number of factors

Queen Ratnamanjuri leaves a puzzle in her will. In a secret room there are 100 lockers and 100 people, numbered 1 to 100.

  • Person 1 opens every locker.
  • Person 2 toggles every 2nd locker (closes it if open, opens it if closed).
  • Person 3 toggles every 3rd locker, person 4 every 4th, and so on up to person 100.

Which lockers stay open at the end? Her son Khoisnam knows before anyone starts.

The key idea: locker number k is touched once by every person whose number is a factor of k. Locker 6 is touched by persons 1, 2, 3 and 6: open, closed, open, closed. Four factors, an even count, so it ends closed. A locker ends open only if it has an odd number of factors.

Partner factors: factors come in pairs whose product is the number. For 6 the pairs are 1 × 6 and 2 × 3. Pairs normally give an even count. The count becomes odd only when a factor pairs with itself, as in 4 = 2 × 2 or 9 = 3 × 3 or 36 = 6 × 6.

A number that is a number multiplied by itself is a square number (a square). Only squares have an odd number of factors, so the open lockers are 1, 4, 9, 16, 25, 36, 49, 64, 81, 100.

Second clue: the passcode is the first five lockers touched exactly twice. A number with exactly two factors (1 and itself) is a prime, so the code is 2-3-5-7-11.

123456789101112131415161718192021222324252627282930green = open: 1, 4, 9, 16, 25 (squares)locker 6: persons 1, 2, 3, 6 → 4 toggles → closed

Tap the diagram to enlarge it

After all 100 people have had a turn, only lockers with square numbers are open; here are the first 30.
📌 Remember these
  1. Factors come in partner pairs
  2. Squares have one self-partner
  3. Primes have exactly two factors
✅ Quick check
→