HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /A school corridor has 1000 lockers, numbered 1 to 1000, all closed…
AdvancedMathematicsHigh School (11–12)Number TheoryConceptualNumericalOlympiad

A school corridor has 1000 lockers, numbered 1 to 1000, all closed…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

A school corridor has 100010001000 lockers, numbered 111 to 100010001000, all closed. Student 111 opens every locker. Student 222 changes every second locker (closes it if open, opens it if closed). Student 333 changes every third locker, and so on, up to student 100010001000.

  1. Explain why locker nnn is changed exactly τ(n)\tau(n)τ(n) times.
  1. Which lockers are open at the end? How many are there?
  1. How many lockers are changed exactly 333 times?

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

For n=∏piain = \prod p_i^{a_i}n=∏piai​​: τ(n)=∏(ai+1)\tau(n) = \prod (a_i + 1)τ(n)=∏(ai​+1) and σ(n)=∏piai+1−1pi−1\sigma(n) = \prod \dfrac{p_i^{a_i + 1} - 1}{p_i - 1}σ(n)=∏pi​−1piai​+1​−1​. τ(n)\tau(n)τ(n) is odd exactly for squares. Even perfect numbers are 2p−1(2p−1)2^{p-1}(2^p - 1)2p−1(2p−1) with 2p−12^p - 12p−1 prime.

The worked solution

Check an answer or open a hint to unlock the worked solution.

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Step 1. Part (a). Student kkk changes locker nnn when kkk divides nnn. Every divisor of nnn is at most 100010001000, so locker nnn is changed once for each divisor: τ(n)\tau(n)τ(n) times.

Step 2. Part (b). A locker starts closed and ends open after an odd number of changes. τ(n)\tau(n)τ(n) is odd exactly when nnn is a perfect square. The squares up to 100010001000 are 12,22,…,3121^2, 2^2, \dots, 31^212,22,…,312, since 312=96131^2 = 961312=961 and 322=102432^2 = 1024322=1024. So 313131 lockers are open.

Step 3. Part (c). τ(n)=3\tau(n) = 3τ(n)=3 forces n=p2n = p^2n=p2 with ppp prime, as 333 is prime. We need p2≤1000p^2 \le 1000p2≤1000, so p≤31p \le 31p≤31. The primes up to 313131 are 2,3,5,7,11,13,17,19,23,29,312, 3, 5, 7, 11, 13, 17, 19, 23, 29, 312,3,5,7,11,13,17,19,23,29,31: there are 111111.

Answer: the open lockers are the 313131 squares; 111111 lockers are changed exactly 333 times.

Log in to save this for later
← All Problems
← A designer wants to tile a rectangle of area 1800 square centimetres with a whole number of rows…A number is perfect when σ(n) = 2n. Prove that if 2ᵖ - 1 is prime, then 2ᵖ⁻¹(2ᵖ - 1) is perfect… →
More onNumber Theory

Discussion (0)

Log in to join the discussion.

Loading…

More on this topic

  1. The triangular numbers are 1, 3, 6, 10, …, where the nth one is (n(n + 1))/2…Advanced
  2. Prove that the equation x³ + y³ + z³ = n has no solution in integers when n leaves remainder 4 or 5…Advanced
  3. Find every triple of positive integers a ≤ b ≤ c with 1/a + 1/b + 1/c = 1, and prove that there are…Advanced
  4. Find all pairs of positive integers (x, y) with x² - y² = 945…Hard
  5. A teacher wants a list of every primitive Pythagorean triple whose hypotenuse is less than 100…Advanced
All problems on this topic →