This puzzle seems to be another way of expressing the classic Sieve of Eratosthenes algorithm.

Basically, all the prisoners in prime numbered cells can escape plus the prisoner in cell 1 (which is not considered prime).

That makes 25 + 1 cells that are unlocked after all the officers have completed their rounds. Therefore 26 prisoners escape!