• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

A math brain teaser

Say you have n prisoners in n individual cells. Beginning with all the cells unlocked, you turn the key of every other cell. You then go back to cell #1 and turn the key of every third cell. You repeat this process until you've turned the key of every nth cell (which in effect means turining the key of the last cell). Keep in mind that turing a key may unlock a cell or it may lock a cell.

There's a pattern that would enable you to know right away which prisoners would have unlocked cells at the end of this process. I only noticed the pattern after writing a program in Maple. I'll post the answer in a little while if nobody figures it out.

 
i don't even know what a perfect square is, but my idea was

2^k such that k is even = 4, 16, 64...
3^k such that k is even = 9, ...
5^k such that k is even = 25, ...
7^k such that k is even = 49...,


OH WAIT, now I know what a perfect square is, yeah I get it, lol that's pretty cool actually.
 
It wouldn't matter, because as soon as you let one of them out, they'll knock your lights out, take the keys off you, and unlock all the others anyways 😀
 
Originally posted by: Random Variable
Say you have n prisoners in n individual cells. Beginning with all the cells unlocked, you turn the key of every other cell. You then go back to cell #1 and turn the key of every third cell. You repeat this process until you've turned the key of every nth cell (which in effect means turining the key of the last cell). Keep in mind that turing a key may unlock a cell or it may lock a cell.

There's a pattern that would enable you to know right away which prisoners would have unlocked cells at the end of this process. I only noticed the pattern after writing a program in Maple. I'll post the answer in a little while if nobody figures it out.

They are in there for a reason... let them rot.
 
the reason it's perfect squares is because they're the only numbers that have an odd number of factors.. every other type of number has an even amount. that's why they stay on the switched state.
 
Topic Title: A math brain teaser
Topic Summary: If you can notice the pattern you're awfully smart
No, not really. As Paul Ma posted, it's an interview-level question that's readily solvable, perhaps with a little assistance from the interviewer.

I would remove the distracting prisoners from the question. Do it on Alcatraz or something. Also, you should reword the first few steps. The method of counting isn't clear until the nth step is described as turning only the nth cell.
 
Back
Top