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.
Rocket your D&D 5E and Level Up: Advanced 5E games into space! Alpha Star Magazine Is Launching... Right Now!
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="tbitonti" data-source="post: 1349479" data-attributes="member: 10416"><p><strong>Every other prisoner ...</strong></p><p></p><p>Math geek alert. <img src="https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f61b.png" class="smilie smilie--emoji" loading="lazy" width="64" height="64" alt=":p" title="Stick out tongue :p" data-smilie="7"data-shortname=":p" /> </p><p></p><p>As an aside, the notes below are really a condensation of doing</p><p>the solution by a complete simulation. Even the chart at the</p><p>bottom is nearly so, as the numbers are a compression of the</p><p>number ranges and offsets.</p><p></p><p>Does anyone know a non-iterative way to solve this using elementary</p><p>functions (or even using Fibonacci numbers, or a base 2 representation</p><p>and a summation)? I put a mini-formula at the bottom, but it's just</p><p>a start.</p><p></p><p>Here are my notes (they read best with a fixed width font):</p><p></p><p>from 1 .. 1000 [by 1] --> take out 1, 3, 5 .. 999 --> leaving 2 .. 1000 [by 2]</p><p> [count == 1000] [count == 500]</p><p>from 2 .. 1000 [by 2] --> take out 2, 6, 10 .. 998 --> leaving 4 .. 1000 [by 4]</p><p> [count == 500] [count == 250]</p><p>from 4 .. 1000 [by 4] --> take out 4, 12, 20 .. 996 --> leaving 8 .. 1000 [by 8]</p><p> [count == 250] [count == 125]</p><p> renumber by dividing by 8.</p><p>from 1 .. 125 [by 1] --> take out 1, 3, 5 .. 125 --> leaving 2 .. 124 [by 2]</p><p> [count == 125] [count == 62]</p><p>from 2 .. 124 [by 2] --> take out 4, 8, 12 .. 124 --> leaving 2 .. 122 [by 4]</p><p> [count == 62] [count == 31]</p><p>from 2 .. 122 [by 4] --> take out 6, 14, 22 .. 118 --> leaving 2 .. 122 [by 8]</p><p> [count == 31] [count == 16]</p><p>from 2 .. 122 [by 8] --> take out 2, 18, 34 .. 114 --> leaving 10 .. 122 [by 16]</p><p> [count == 16] [count == 8]</p><p>from 10 .. 122 [by 16] --> take out 10, 42, 74 .. 104 --> leaving 26 .. 122 [by 32]</p><p> [count == 8] [count == 4]</p><p>from 26 .. 122 [by 32] --> take out 26, 90 --> leaving 58, 122 [by 64]</p><p> [count == 4] [count == 2]</p><p>from 58, 122 [by 64] --> take out 58 --> leaving 122 [by 128]</p><p> [count == 2] [count == 1]</p><p></p><p>Leaving 122.</p><p></p><p>Backing up: 122 * 8 == 976. The 976'th prisoner is last.</p><p></p><p>Model:</p><p></p><p>Prisoner numbers:</p><p> a(i) + (k - 1) * 2^i</p><p></p><p> i gives the generation number</p><p></p><p> a(i) is the number of the first prisoner</p><p></p><p> k ranges from 1 .. K(i)</p><p></p><p> K(i) is the number of prisoners remaining</p><p></p><p> a(i) ... (K(i) - 1) * 2^i gives the prisoner number range</p><p></p><p>The initial generation is generation 0, before any prisoners are removed.</p><p>The initial prisoner number, a(0), is 1.</p><p>The initial prisoner count, K(0), is 1000.</p><p></p><p>Then:</p><p></p><p>For each generation 'i' there is a parity of '0' or '1', where</p><p>parity '0' means that the first prisoner will be removed,</p><p>and parity '1' means that the second prisoner will be removed. </p><p></p><p> P(i) == 0, 1</p><p></p><p>In the given problem, P(0) == 0.</p><p></p><p>For a given 'i', 'P(i+1)' is given by:</p><p></p><p> P(i+1) = P(i) if K(i) is even;</p><p> P(i+1) = P(i) + 1 (mod 2) if K(i) is odd.</p><p></p><p>For a given 'i', 'a(i+1)' is given by:</p><p></p><p> a(i+1) = a(i) + 2^i if P(i) is 0;</p><p> a(i+1) = a(i) if P(i) is 1.</p><p></p><p>For a given 'i', 'K(i+1)' is given by:</p><p></p><p> K(i+1) = K(i) / 2 if K(i) is even;</p><p> K(i+1) = (K(i) + 1) / 2 if K(i) is odd and P(i) is 1;</p><p> K(i+1) = (K(i) - 1) / 2 if K(i) is odd and P(i) is 0.</p><p></p><p>Then:</p><p></p><p> i a(i) P(i) K(i) 2^i</p><p> 0 1 0 1000 1</p><p> 1 2 0 500 2</p><p> 2 4 0 250 4</p><p> 3 8 0 125 8</p><p> 4 16 1 62 16</p><p> 5 16 1 31 32</p><p> 6 16 0 16 64</p><p> 7 80 0 8 128</p><p> 8 208 0 4 256</p><p> 9 464 0 2 512</p><p> 10 976 0 1 1024</p><p></p><p>Note that 976 == 1024 - 48 == 1024 - 32 - 16,</p><p>that is:</p><p></p><p>a(10) == 976 == sum { 0 .. 9 } of ( 2^i * (1 - P(i)) ) + 1</p><p></p><p>But, how does P(i) relate to the initial number?</p></blockquote><p></p>
[QUOTE="tbitonti, post: 1349479, member: 10416"] [b]Every other prisoner ...[/b] Math geek alert. :p As an aside, the notes below are really a condensation of doing the solution by a complete simulation. Even the chart at the bottom is nearly so, as the numbers are a compression of the number ranges and offsets. Does anyone know a non-iterative way to solve this using elementary functions (or even using Fibonacci numbers, or a base 2 representation and a summation)? I put a mini-formula at the bottom, but it's just a start. Here are my notes (they read best with a fixed width font): from 1 .. 1000 [by 1] --> take out 1, 3, 5 .. 999 --> leaving 2 .. 1000 [by 2] [count == 1000] [count == 500] from 2 .. 1000 [by 2] --> take out 2, 6, 10 .. 998 --> leaving 4 .. 1000 [by 4] [count == 500] [count == 250] from 4 .. 1000 [by 4] --> take out 4, 12, 20 .. 996 --> leaving 8 .. 1000 [by 8] [count == 250] [count == 125] renumber by dividing by 8. from 1 .. 125 [by 1] --> take out 1, 3, 5 .. 125 --> leaving 2 .. 124 [by 2] [count == 125] [count == 62] from 2 .. 124 [by 2] --> take out 4, 8, 12 .. 124 --> leaving 2 .. 122 [by 4] [count == 62] [count == 31] from 2 .. 122 [by 4] --> take out 6, 14, 22 .. 118 --> leaving 2 .. 122 [by 8] [count == 31] [count == 16] from 2 .. 122 [by 8] --> take out 2, 18, 34 .. 114 --> leaving 10 .. 122 [by 16] [count == 16] [count == 8] from 10 .. 122 [by 16] --> take out 10, 42, 74 .. 104 --> leaving 26 .. 122 [by 32] [count == 8] [count == 4] from 26 .. 122 [by 32] --> take out 26, 90 --> leaving 58, 122 [by 64] [count == 4] [count == 2] from 58, 122 [by 64] --> take out 58 --> leaving 122 [by 128] [count == 2] [count == 1] Leaving 122. Backing up: 122 * 8 == 976. The 976'th prisoner is last. Model: Prisoner numbers: a(i) + (k - 1) * 2^i i gives the generation number a(i) is the number of the first prisoner k ranges from 1 .. K(i) K(i) is the number of prisoners remaining a(i) ... (K(i) - 1) * 2^i gives the prisoner number range The initial generation is generation 0, before any prisoners are removed. The initial prisoner number, a(0), is 1. The initial prisoner count, K(0), is 1000. Then: For each generation 'i' there is a parity of '0' or '1', where parity '0' means that the first prisoner will be removed, and parity '1' means that the second prisoner will be removed. P(i) == 0, 1 In the given problem, P(0) == 0. For a given 'i', 'P(i+1)' is given by: P(i+1) = P(i) if K(i) is even; P(i+1) = P(i) + 1 (mod 2) if K(i) is odd. For a given 'i', 'a(i+1)' is given by: a(i+1) = a(i) + 2^i if P(i) is 0; a(i+1) = a(i) if P(i) is 1. For a given 'i', 'K(i+1)' is given by: K(i+1) = K(i) / 2 if K(i) is even; K(i+1) = (K(i) + 1) / 2 if K(i) is odd and P(i) is 1; K(i+1) = (K(i) - 1) / 2 if K(i) is odd and P(i) is 0. Then: i a(i) P(i) K(i) 2^i 0 1 0 1000 1 1 2 0 500 2 2 4 0 250 4 3 8 0 125 8 4 16 1 62 16 5 16 1 31 32 6 16 0 16 64 7 80 0 8 128 8 208 0 4 256 9 464 0 2 512 10 976 0 1 1024 Note that 976 == 1024 - 48 == 1024 - 32 - 16, that is: a(10) == 976 == sum { 0 .. 9 } of ( 2^i * (1 - P(i)) ) + 1 But, how does P(i) relate to the initial number? [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*TTRPGs General
Best...Puzzle...Ever....
Top