Problem: You have 100 balls with their numbers written on them. You throw away the first ball, skip the second, throw away the third, skip the fourth, etc. When you get to the end you loop back to the beginning of the remaining balls. So after the first pass through you'll end up with the even numbered balls (2, 4, 6, ... 100). Because on the first pass you kept 100, on the second pass through you'll throw away 2, keep 4, throw away 6, etc. You keep throwing away a ball and skipping one until there's one ball left. Which numbered ball is left?
I know the answer by just going through it manually, but I was wondering if there's a way to do this with a formula/Algorithm/some math way. I'll be translating the answer into computer code.
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment