Student k touches locker n exactly when k is a factor of n. So the number of times a locker is toggled is the number of factors of its number. A locker that starts shut ends open only if it is toggled an odd number of times, and only perfect squares have an odd number of factors (one factor is its own partner).
(i) The perfect squares up to 30 are 1,4,9,16,25 (62=36 is too big). So 5 lockers are open.
(1 mark)
(ii) A locker is touched by exactly four students when its number has exactly 4 factors, that is, exactly two pairs of different partner factors. Checking 1 to 30, these are
6,8,10,14,15,21,22,26,27
For example, 6=1×6=2×3 and 27=1×27=3×9. So 9 lockers are touched by exactly four students. (Each is either a product of two different primes, such as 15=3×5, or the cube of a prime: 8=23 and 27=33.)
(1 mark)
(iii) A locker is touched by exactly two students when its number has exactly two factors, 1 and itself. These are the prime numbers: a prime has no factor other than 1 and itself, and every other number has either one factor (only locker 1) or at least three (a number like 18 also has factors 2, 3, 6 and 9 between 1 and itself). The primes up to 30 are
2,3,5,7,11,13,17,19,23,29
So 10 lockers are touched by exactly two students.
(2 marks)