All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Optimizing Potency (Posted on 2015-11-19) Difficulty: 4 of 5
My pills, which I buy 31 at a time, come in an airtight canister. Last month (December), I opened the canister 31 times, removing (and swallowing) one pill every day. The problem is that the last pill I took on December 31 was exposed to the air 31 times, which diminishes its potency. The December 1 pill was only exposed to air once. On average, the pills that I took were exposed to the air 16 times, calculated as (1 + 31)/2.

But I can do better in January, because now I have an empty canister!

On January 1, I could swallow one pill and transfer 15 to the empty canister. If I make no more transfers, the remaining 30 pills will be exposed an additional 8 times on average, i.e (15+1)/2, in addition to the once that they have already been exposed. Average time exposed for all 31 pills is (1 + 30*(8+1))/31 = 271/31 = 8.742. A significant improvement from 16! I feel healthier already!

I think that I can do better if I transfer pills between my two canisters more frequently. What is the best I can do? How?

See The Solution Submitted by Steve Herman    
Rating: 5.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Triangular numbers and Pascal's Triangle (spoiler) | Comment 7 of 10 |
I have just posted a detailed solution.  Recommended reading for anybody following this problem (which might only be Broll and Jer and myself).

I have revealed the algorithm that works for two containers and any number of starting pills.  It has a very interesting relationship to triangular numbers.  I almost wished that I had started with a four week supply (28 pills), as that has a unique solution (because 28 is a triangular number).  And the optimal is 140 exposures, which averages out to exactly 5 exposures per pill.  31, on the other hand, has 56 different solutions, all yielding the optimal 164/31 exposures per pill.

And, speaking of triangles, the number of solutions for any given starting number of pills is a row from Pascal's triangle.  For instance, the number of different solutions for 28 through 36 pills (respectively) are 1, 8, 28, 56, 70, 56, 28, 8, 1, which is the 8th row of Pascal's triangle.  I assert this without proof.  It is just one of a number of pleasing results that arose from my investigation of this original problem. 

  Posted by Steve Herman on 2015-11-26 09:14:27
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information