Menu
News
All News
Dungeons & Dragons
Level Up: Advanced 5th Edition
Pathfinder
Starfinder
Warhammer
2d20 System
Year Zero Engine
Industry News
Reviews
Dragon Reflections
White Dwarf Reflections
Columns
Weekly Digests
Weekly News Digest
Freebies, Sales & Bundles
RPG Print News
RPG Crowdfunding News
Game Content
ENterplanetary DimENsions
Mythological Figures
Opinion
Worlds of Design
Peregrine's Nest
RPG Evolution
Other Columns
From the Freelancing Frontline
Monster ENcyclopedia
WotC/TSR Alumni Look Back
4 Hours w/RSD (Ryan Dancey)
The Road to 3E (Jonathan Tweet)
Greenwood's Realms (Ed Greenwood)
Drawmij's TSR (Jim Ward)
Community
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions, OSR, & D&D Variants
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Resources
Wiki
Pages
Latest activity
Media
New media
New comments
Search media
Downloads
Latest reviews
Search resources
EN Publishing
Store
EN5ider
Adventures in ZEITGEIST
Awfully Cheerful Engine
What's OLD is NEW
Judge Dredd & The Worlds Of 2000AD
War of the Burning Sky
Level Up: Advanced 5E
Events & Releases
Upcoming Events
Private Events
Featured Events
Socials!
EN Publishing
Twitter
BlueSky
Facebook
Instagram
EN World
BlueSky
YouTube
Facebook
Twitter
Twitch
Podcast
Features
Top 5 RPGs Compiled Charts 2004-Present
Adventure Game Industry Market Research Summary (RPGs) V1.0
Ryan Dancey: Acquiring TSR
Q&A With Gary Gygax
D&D Rules FAQs
TSR, WotC, & Paizo: A Comparative History
D&D Pronunciation Guide
Million Dollar TTRPG Kickstarters
Tabletop RPG Podcast Hall of Fame
Eric Noah's Unofficial D&D 3rd Edition News
D&D in the Mainstream
D&D & RPG History
About Morrus
Log in
Register
What's new
Search
Search
Search titles only
By:
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions, OSR, & D&D Variants
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Menu
Log in
Register
Install the app
Install
Upgrade your account to a Community Supporter account and remove most of the site ads.
Community
General Tabletop Discussion
*TTRPGs General
Best...Puzzle...Ever....
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="orsal" data-source="post: 1349627" data-attributes="member: 16016"><p><strong>prisoner solution</strong></p><p></p><p></p><p></p><p>Sure. Here's a solution involving binary representation, although at the end I'll turn the final answer into a straight arithmetic formula.</p><p></p><p>First time through, you're knocking out all the odd numbers, i.e. those ending in 1. Once you've done that, since everything left ends in 0, you can erase the final zero to prepare for the next round. So when you're ready to start round 2, you've renumbered your round-1 survivors from 1-500, although the prisoner now numbered k used to be numbered 2k.</p><p></p><p>Since 1000 is even, the last prisoner survives the first round. That means the second round proceeds the same as the first round, with the first prisoner in line, and all who now have odd numbers (second bit from the right is 1) getting killed and those whose second bit from the right is 0 surviving.</p><p></p><p>Likewise, since 1000 has 0 for its second and third rightmost bits, the third and fourth rounds will eliminate those whose third and fourth bits respectively are 1.</p><p></p><p>But the third round will leave 125 prisoners, number 1-125 (after their three trailing 0's have been erased. This is odd, so the fourth round will kill the last prisoner. That means that the fifth round will begin by sparing the first prisoner, and continue by killing the even numbers and sparing the odd numbers.</p><p></p><p>Notice the key property of 1000: its fourth-smallest bit, which becomes the smallest bit on the fourth round, is a 1. That tells you that on the fifth round its the numbers with 1 for their now-smallest (originally fifth-smallest) bit that get spared.</p><p></p><p>You see the pattern: whatever bit (0 or 1) 1000 has in any given place, survivors must have the same bit in the next place to the left. In other words, the final survivor must look like the original number of prisoners (in this case 1000), shifted one bit to the left, with the leading one erased (so that the number isn't bigger than 1000).</p><p></p><p>Now shifting the whole number one place to the left with a trailing 0 is equivalent to multiplying by 2. Erasing the leading 1 is subtracting the highest power of two smaller than the now-doubled number, or equivalently the smallest power of 2 larger than the original number.</p><p></p><p>So, if you have n prisoners, the survivor is 2n-p, where p is the next power of 2 after n. In this case, 2x1000-1024-976.</p><p></p><p>And when you write</p><p></p><p></p><p></p><p>you miss the more interesting breakdown: 976=1024-24-24, the 24 being relevant because 1000=1024-24.</p></blockquote><p></p>
[QUOTE="orsal, post: 1349627, member: 16016"] [b]prisoner solution[/b] Sure. Here's a solution involving binary representation, although at the end I'll turn the final answer into a straight arithmetic formula. First time through, you're knocking out all the odd numbers, i.e. those ending in 1. Once you've done that, since everything left ends in 0, you can erase the final zero to prepare for the next round. So when you're ready to start round 2, you've renumbered your round-1 survivors from 1-500, although the prisoner now numbered k used to be numbered 2k. Since 1000 is even, the last prisoner survives the first round. That means the second round proceeds the same as the first round, with the first prisoner in line, and all who now have odd numbers (second bit from the right is 1) getting killed and those whose second bit from the right is 0 surviving. Likewise, since 1000 has 0 for its second and third rightmost bits, the third and fourth rounds will eliminate those whose third and fourth bits respectively are 1. But the third round will leave 125 prisoners, number 1-125 (after their three trailing 0's have been erased. This is odd, so the fourth round will kill the last prisoner. That means that the fifth round will begin by sparing the first prisoner, and continue by killing the even numbers and sparing the odd numbers. Notice the key property of 1000: its fourth-smallest bit, which becomes the smallest bit on the fourth round, is a 1. That tells you that on the fifth round its the numbers with 1 for their now-smallest (originally fifth-smallest) bit that get spared. You see the pattern: whatever bit (0 or 1) 1000 has in any given place, survivors must have the same bit in the next place to the left. In other words, the final survivor must look like the original number of prisoners (in this case 1000), shifted one bit to the left, with the leading one erased (so that the number isn't bigger than 1000). Now shifting the whole number one place to the left with a trailing 0 is equivalent to multiplying by 2. Erasing the leading 1 is subtracting the highest power of two smaller than the now-doubled number, or equivalently the smallest power of 2 larger than the original number. So, if you have n prisoners, the survivor is 2n-p, where p is the next power of 2 after n. In this case, 2x1000-1024-976. And when you write you miss the more interesting breakdown: 976=1024-24-24, the 24 being relevant because 1000=1024-24. [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*TTRPGs General
Best...Puzzle...Ever....
Top