Each cell number 1-100 (say it k) is the product of two integers, say m*n. If k is prime, there is only one pair of (m, n); otherwise there are more.
Doors, being initially locked ("There are 100 prisoners in 100 separate locked cells."), prison officer m (m is a divisor of k) visits the cell k and unlocks it, while later prison officer n in its visit locks the cell.
Lucky cells are 10: those that have odd number of divisors, where m=n, that means no prison officer visits the cell later, which means k = perfect square
1, 4, 9, 16, 25, 36, 49, 64, 81, 100.
More information about formatting options