Box of tablets, whole or broken: solution requiredFigure out the codeHow to get a uniform 1 out of 7 chance, using only a coin and a 6-sided dieThe Tourney of a Thousand PrincesThe Fanatic Fever(twist on the 5 pirates puzzle)Six days of illness (Part 1)Six days of illness (Part 2)Ant on a hyperboxMy colleague who liked to puzzle, riddle, juggleFinding unique number propertiesThe Pebbles Quiz

What would be the challenges to taking off and landing a typical passenger jet at FL300?

Is there any music source code for sound chips?

Would it be possible to have a GMO that produces chocolate?

How much authority do teachers get from *In Loco Parentis*?

Can a Rogue PC teach an NPC to perform Sneak Attack?

The Knight's estate

Position a tabular on the corner of a slide

Why in most German places is the church the tallest building?

"Sorry to bother you" in an email?

Why did MS-DOS applications built using Turbo Pascal fail to start with a division by zero error on faster systems?

Is there any practical application for performing a double Fourier transform? ...or an inverse Fourier transform on a time-domain input?

Converting a set into a string

French abbreviation for comparing two items ("vs")

Why is there so little discussion / research on the philosophy of precision?

Prove your innocence

Why would an IIS hosted site prompt for AD account credential if accessed through a hostname or IP, but not through servername?

Immutable builder and updater

Pythagorean triple with hypotenuse a power of 2

How do I request a longer than normal leave of absence period for my wedding?

Is it possible to perform a regression where you have an unknown / unknowable feature variable?

How many US airports have 4 or more parallel runways?

Read file lines into shell line separated by space

Was it ever possible to target a zone?

SQL Server Management Studio - Why is Dark Theme Disabled by Default?



Box of tablets, whole or broken: solution required


Figure out the codeHow to get a uniform 1 out of 7 chance, using only a coin and a 6-sided dieThe Tourney of a Thousand PrincesThe Fanatic Fever(twist on the 5 pirates puzzle)Six days of illness (Part 1)Six days of illness (Part 2)Ant on a hyperboxMy colleague who liked to puzzle, riddle, juggleFinding unique number propertiesThe Pebbles Quiz






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








15












$begingroup$


This is a puzzle that I thought up whilst taking a course of meds. I currently haven’t solved it, and would be curious to know if anyone has a solution for it. Here goes:



Scenario:
John has a box of 15 tablets. He needs to take half a tablet per day for 30 days. Each day he takes the box and removes a tablet randomly (i.e. the chance of him removing a whole tablet is equal to him removing a half tablet when the number of whole- and half-tablets are equal. E.g. if there were 5 whole and 1 half tablet in the box, then p(half) = 1/6).
If the tablet he removes is a whole one, he breaks it in half, eats one half, and returns the other half back to the box. If he removes a half tablet, he just consumes it. This continues for 30 days.



Question: On which day (on average, assuming infinite re-runs of the process) is he first going to be equally/more likely to remove a half tablet than a whole one?



I already have given this some thought, but even counting the number of permutations is impossible for me extrapolation from a 1 to 2 to 3 to 4 tablet simplification of the 15 tablet scenario above.



Any ideas/solutions welcome. Preferably the solutions would be hidden in a spoiler box, as for the time being I’m still trying to work it out myself.



Many thanks!










share|improve this question











$endgroup$









  • 3




    $begingroup$
    Welcome to Puzzling! (Take the Tour!) I'm glad you’re interested in contributing this question here but I fear it likely falls on the wrong side of our policy on math problems vs puzzles — see Are math-textbook-style problems on topic? for some discussion. It’s an interesting question to want an answer to, but probably not enough on-topic to be here.
    $endgroup$
    – Rubio
    Aug 12 at 0:18






  • 4




    $begingroup$
    @Rubio IMO this is on the fence, but I think it should be ok. It's definitely not a textbook question for sure, and I do find it quite an interesting problem. So, I personally have no problem with this question, but I'd like to know what everyone else thinks.
    $endgroup$
    – greenturtle3141
    Aug 12 at 2:12






  • 1




    $begingroup$
    @greenturtle3141 The solution path is mechanical, the answer is pretty much what I'd expect, and there's no particular magic about the answer—those are pretty much the hallmarks of "problem". Having said that, I (like you) am on the fence enough that I feel I need to leave it up to the community to decide. :)
    $endgroup$
    – Rubio
    Aug 12 at 3:39










  • $begingroup$
    As a person who submitted an answer, I have to agree that this didn't feel like a puzzle. I had fun finding an answer, but it was more of a coding problem than a puzzle. I think there might be a more elegant solution that involves thinking about the problem in forward time and backward time, but even then it would probably be a math problem.
    $endgroup$
    – hdsdv
    Aug 12 at 9:24






  • 1




    $begingroup$
    "removes a tablet perfectly randomly": Are we to assume that it's as likely that he'll pick a half as a whole, or that it's half as likely (because there's only one end to grasp but two ends of the whole tablet making the latter easier to choose)? Or should we work that out for ourselves as part of the solution?
    $endgroup$
    – msh210
    Aug 12 at 9:48


















15












$begingroup$


This is a puzzle that I thought up whilst taking a course of meds. I currently haven’t solved it, and would be curious to know if anyone has a solution for it. Here goes:



Scenario:
John has a box of 15 tablets. He needs to take half a tablet per day for 30 days. Each day he takes the box and removes a tablet randomly (i.e. the chance of him removing a whole tablet is equal to him removing a half tablet when the number of whole- and half-tablets are equal. E.g. if there were 5 whole and 1 half tablet in the box, then p(half) = 1/6).
If the tablet he removes is a whole one, he breaks it in half, eats one half, and returns the other half back to the box. If he removes a half tablet, he just consumes it. This continues for 30 days.



Question: On which day (on average, assuming infinite re-runs of the process) is he first going to be equally/more likely to remove a half tablet than a whole one?



I already have given this some thought, but even counting the number of permutations is impossible for me extrapolation from a 1 to 2 to 3 to 4 tablet simplification of the 15 tablet scenario above.



Any ideas/solutions welcome. Preferably the solutions would be hidden in a spoiler box, as for the time being I’m still trying to work it out myself.



Many thanks!










share|improve this question











$endgroup$









  • 3




    $begingroup$
    Welcome to Puzzling! (Take the Tour!) I'm glad you’re interested in contributing this question here but I fear it likely falls on the wrong side of our policy on math problems vs puzzles — see Are math-textbook-style problems on topic? for some discussion. It’s an interesting question to want an answer to, but probably not enough on-topic to be here.
    $endgroup$
    – Rubio
    Aug 12 at 0:18






  • 4




    $begingroup$
    @Rubio IMO this is on the fence, but I think it should be ok. It's definitely not a textbook question for sure, and I do find it quite an interesting problem. So, I personally have no problem with this question, but I'd like to know what everyone else thinks.
    $endgroup$
    – greenturtle3141
    Aug 12 at 2:12






  • 1




    $begingroup$
    @greenturtle3141 The solution path is mechanical, the answer is pretty much what I'd expect, and there's no particular magic about the answer—those are pretty much the hallmarks of "problem". Having said that, I (like you) am on the fence enough that I feel I need to leave it up to the community to decide. :)
    $endgroup$
    – Rubio
    Aug 12 at 3:39










  • $begingroup$
    As a person who submitted an answer, I have to agree that this didn't feel like a puzzle. I had fun finding an answer, but it was more of a coding problem than a puzzle. I think there might be a more elegant solution that involves thinking about the problem in forward time and backward time, but even then it would probably be a math problem.
    $endgroup$
    – hdsdv
    Aug 12 at 9:24






  • 1




    $begingroup$
    "removes a tablet perfectly randomly": Are we to assume that it's as likely that he'll pick a half as a whole, or that it's half as likely (because there's only one end to grasp but two ends of the whole tablet making the latter easier to choose)? Or should we work that out for ourselves as part of the solution?
    $endgroup$
    – msh210
    Aug 12 at 9:48














15












15








15


2



$begingroup$


This is a puzzle that I thought up whilst taking a course of meds. I currently haven’t solved it, and would be curious to know if anyone has a solution for it. Here goes:



Scenario:
John has a box of 15 tablets. He needs to take half a tablet per day for 30 days. Each day he takes the box and removes a tablet randomly (i.e. the chance of him removing a whole tablet is equal to him removing a half tablet when the number of whole- and half-tablets are equal. E.g. if there were 5 whole and 1 half tablet in the box, then p(half) = 1/6).
If the tablet he removes is a whole one, he breaks it in half, eats one half, and returns the other half back to the box. If he removes a half tablet, he just consumes it. This continues for 30 days.



Question: On which day (on average, assuming infinite re-runs of the process) is he first going to be equally/more likely to remove a half tablet than a whole one?



I already have given this some thought, but even counting the number of permutations is impossible for me extrapolation from a 1 to 2 to 3 to 4 tablet simplification of the 15 tablet scenario above.



Any ideas/solutions welcome. Preferably the solutions would be hidden in a spoiler box, as for the time being I’m still trying to work it out myself.



Many thanks!










share|improve this question











$endgroup$




This is a puzzle that I thought up whilst taking a course of meds. I currently haven’t solved it, and would be curious to know if anyone has a solution for it. Here goes:



Scenario:
John has a box of 15 tablets. He needs to take half a tablet per day for 30 days. Each day he takes the box and removes a tablet randomly (i.e. the chance of him removing a whole tablet is equal to him removing a half tablet when the number of whole- and half-tablets are equal. E.g. if there were 5 whole and 1 half tablet in the box, then p(half) = 1/6).
If the tablet he removes is a whole one, he breaks it in half, eats one half, and returns the other half back to the box. If he removes a half tablet, he just consumes it. This continues for 30 days.



Question: On which day (on average, assuming infinite re-runs of the process) is he first going to be equally/more likely to remove a half tablet than a whole one?



I already have given this some thought, but even counting the number of permutations is impossible for me extrapolation from a 1 to 2 to 3 to 4 tablet simplification of the 15 tablet scenario above.



Any ideas/solutions welcome. Preferably the solutions would be hidden in a spoiler box, as for the time being I’m still trying to work it out myself.



Many thanks!







mathematics probability number-theory






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 13 at 0:56









msh210

9397 silver badges23 bronze badges




9397 silver badges23 bronze badges










asked Aug 11 at 22:11









DavidDavid

764 bronze badges




764 bronze badges










  • 3




    $begingroup$
    Welcome to Puzzling! (Take the Tour!) I'm glad you’re interested in contributing this question here but I fear it likely falls on the wrong side of our policy on math problems vs puzzles — see Are math-textbook-style problems on topic? for some discussion. It’s an interesting question to want an answer to, but probably not enough on-topic to be here.
    $endgroup$
    – Rubio
    Aug 12 at 0:18






  • 4




    $begingroup$
    @Rubio IMO this is on the fence, but I think it should be ok. It's definitely not a textbook question for sure, and I do find it quite an interesting problem. So, I personally have no problem with this question, but I'd like to know what everyone else thinks.
    $endgroup$
    – greenturtle3141
    Aug 12 at 2:12






  • 1




    $begingroup$
    @greenturtle3141 The solution path is mechanical, the answer is pretty much what I'd expect, and there's no particular magic about the answer—those are pretty much the hallmarks of "problem". Having said that, I (like you) am on the fence enough that I feel I need to leave it up to the community to decide. :)
    $endgroup$
    – Rubio
    Aug 12 at 3:39










  • $begingroup$
    As a person who submitted an answer, I have to agree that this didn't feel like a puzzle. I had fun finding an answer, but it was more of a coding problem than a puzzle. I think there might be a more elegant solution that involves thinking about the problem in forward time and backward time, but even then it would probably be a math problem.
    $endgroup$
    – hdsdv
    Aug 12 at 9:24






  • 1




    $begingroup$
    "removes a tablet perfectly randomly": Are we to assume that it's as likely that he'll pick a half as a whole, or that it's half as likely (because there's only one end to grasp but two ends of the whole tablet making the latter easier to choose)? Or should we work that out for ourselves as part of the solution?
    $endgroup$
    – msh210
    Aug 12 at 9:48













  • 3




    $begingroup$
    Welcome to Puzzling! (Take the Tour!) I'm glad you’re interested in contributing this question here but I fear it likely falls on the wrong side of our policy on math problems vs puzzles — see Are math-textbook-style problems on topic? for some discussion. It’s an interesting question to want an answer to, but probably not enough on-topic to be here.
    $endgroup$
    – Rubio
    Aug 12 at 0:18






  • 4




    $begingroup$
    @Rubio IMO this is on the fence, but I think it should be ok. It's definitely not a textbook question for sure, and I do find it quite an interesting problem. So, I personally have no problem with this question, but I'd like to know what everyone else thinks.
    $endgroup$
    – greenturtle3141
    Aug 12 at 2:12






  • 1




    $begingroup$
    @greenturtle3141 The solution path is mechanical, the answer is pretty much what I'd expect, and there's no particular magic about the answer—those are pretty much the hallmarks of "problem". Having said that, I (like you) am on the fence enough that I feel I need to leave it up to the community to decide. :)
    $endgroup$
    – Rubio
    Aug 12 at 3:39










  • $begingroup$
    As a person who submitted an answer, I have to agree that this didn't feel like a puzzle. I had fun finding an answer, but it was more of a coding problem than a puzzle. I think there might be a more elegant solution that involves thinking about the problem in forward time and backward time, but even then it would probably be a math problem.
    $endgroup$
    – hdsdv
    Aug 12 at 9:24






  • 1




    $begingroup$
    "removes a tablet perfectly randomly": Are we to assume that it's as likely that he'll pick a half as a whole, or that it's half as likely (because there's only one end to grasp but two ends of the whole tablet making the latter easier to choose)? Or should we work that out for ourselves as part of the solution?
    $endgroup$
    – msh210
    Aug 12 at 9:48








3




3




$begingroup$
Welcome to Puzzling! (Take the Tour!) I'm glad you’re interested in contributing this question here but I fear it likely falls on the wrong side of our policy on math problems vs puzzles — see Are math-textbook-style problems on topic? for some discussion. It’s an interesting question to want an answer to, but probably not enough on-topic to be here.
$endgroup$
– Rubio
Aug 12 at 0:18




$begingroup$
Welcome to Puzzling! (Take the Tour!) I'm glad you’re interested in contributing this question here but I fear it likely falls on the wrong side of our policy on math problems vs puzzles — see Are math-textbook-style problems on topic? for some discussion. It’s an interesting question to want an answer to, but probably not enough on-topic to be here.
$endgroup$
– Rubio
Aug 12 at 0:18




4




4




$begingroup$
@Rubio IMO this is on the fence, but I think it should be ok. It's definitely not a textbook question for sure, and I do find it quite an interesting problem. So, I personally have no problem with this question, but I'd like to know what everyone else thinks.
$endgroup$
– greenturtle3141
Aug 12 at 2:12




$begingroup$
@Rubio IMO this is on the fence, but I think it should be ok. It's definitely not a textbook question for sure, and I do find it quite an interesting problem. So, I personally have no problem with this question, but I'd like to know what everyone else thinks.
$endgroup$
– greenturtle3141
Aug 12 at 2:12




1




1




$begingroup$
@greenturtle3141 The solution path is mechanical, the answer is pretty much what I'd expect, and there's no particular magic about the answer—those are pretty much the hallmarks of "problem". Having said that, I (like you) am on the fence enough that I feel I need to leave it up to the community to decide. :)
$endgroup$
– Rubio
Aug 12 at 3:39




$begingroup$
@greenturtle3141 The solution path is mechanical, the answer is pretty much what I'd expect, and there's no particular magic about the answer—those are pretty much the hallmarks of "problem". Having said that, I (like you) am on the fence enough that I feel I need to leave it up to the community to decide. :)
$endgroup$
– Rubio
Aug 12 at 3:39












$begingroup$
As a person who submitted an answer, I have to agree that this didn't feel like a puzzle. I had fun finding an answer, but it was more of a coding problem than a puzzle. I think there might be a more elegant solution that involves thinking about the problem in forward time and backward time, but even then it would probably be a math problem.
$endgroup$
– hdsdv
Aug 12 at 9:24




$begingroup$
As a person who submitted an answer, I have to agree that this didn't feel like a puzzle. I had fun finding an answer, but it was more of a coding problem than a puzzle. I think there might be a more elegant solution that involves thinking about the problem in forward time and backward time, but even then it would probably be a math problem.
$endgroup$
– hdsdv
Aug 12 at 9:24




1




1




$begingroup$
"removes a tablet perfectly randomly": Are we to assume that it's as likely that he'll pick a half as a whole, or that it's half as likely (because there's only one end to grasp but two ends of the whole tablet making the latter easier to choose)? Or should we work that out for ourselves as part of the solution?
$endgroup$
– msh210
Aug 12 at 9:48





$begingroup$
"removes a tablet perfectly randomly": Are we to assume that it's as likely that he'll pick a half as a whole, or that it's half as likely (because there's only one end to grasp but two ends of the whole tablet making the latter easier to choose)? Or should we work that out for ourselves as part of the solution?
$endgroup$
– msh210
Aug 12 at 9:48











1 Answer
1






active

oldest

votes


















9













$begingroup$


It turns out that on the 14th (edited from 13th - I was using zero index before) day, you are more likely to pick a half pill than a whole pill. On that day, the expected number of whole pills is ~5.597 and the expected number of half pills is ~5.807.




To do this,




I just wrote a Python program that enumerates all the possible outcomes each day, along with the probability that each outcome would occur. To compute tomorrow's possible outcomes, you take each possible situation S from today and check each "branch" that can happen - selecting a whole or half pill. Each branch has a probability of occurring (based on how many of each are in S), and a resulting situation (one less half pill, or one less whole pill and one more half pill). You multiply the probability of being in S by the probability of taking the branch, and add that to tomorrow's probability for S', the new situation that we just created.




Finally,




For each day, you can compute the expected number of whole pills (just multiply the number of whole pills in each situation by the probability of the situation). The total expected whole pills for the day will be the sum of all of these values. The same can be done for the half pills (and if you want to check your work, 2*expected_whole + expected_half should equal (30 - day), since that's how many total half-pills you still have left).




I can give you the Python code if you want. Not sure it can be spoilered (I've never learned how to have multi-line spoilers).



Python Code






share|improve this answer











$endgroup$










  • 3




    $begingroup$
    Rather than post code here, you should probably post it at (say) tio.run and link to it here - that way people can run it without having to download it and/or a python interpreter.
    $endgroup$
    – Rubio
    Aug 12 at 0:06






  • 2




    $begingroup$
    Thanks for the suggestion! Done.
    $endgroup$
    – hdsdv
    Aug 12 at 0:26










  • $begingroup$
    Re "Each branch has a probability of occurring": You may want to see my comment on the question.
    $endgroup$
    – msh210
    Aug 12 at 9:49










  • $begingroup$
    I think if John were half as likely to choose a half pill than a whole pill, that would have been specified. It seems like a pretty important detail to leave out when everything else was specified unambiguously. This wasn't presented as a "find the small detail that I intentionally left out" puzzle.
    $endgroup$
    – hdsdv
    Aug 12 at 10:15






  • 1




    $begingroup$
    @MSH210 et al. Thank you for your responses. I’m a newbie here, I’m sorry if this doesn’t comply to your definition of a puzzle. Thanks for your responses in any case. Regarding “remove a tablet perfectly randomly”: Perhaps I should have expressed it differently. I imagined that John tips a (half) tablet out of the box, and the chance that it is a whole one reflects the proportion of whole tablets in the box (so for example if there are 6 whole and 2 half tablets in the box, p(whole)=0.75, p(half)=0.25. I hope that makes ig clear.
    $endgroup$
    – David
    Aug 12 at 20:47













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "559"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fpuzzling.stackexchange.com%2fquestions%2f87023%2fbox-of-tablets-whole-or-broken-solution-required%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









9













$begingroup$


It turns out that on the 14th (edited from 13th - I was using zero index before) day, you are more likely to pick a half pill than a whole pill. On that day, the expected number of whole pills is ~5.597 and the expected number of half pills is ~5.807.




To do this,




I just wrote a Python program that enumerates all the possible outcomes each day, along with the probability that each outcome would occur. To compute tomorrow's possible outcomes, you take each possible situation S from today and check each "branch" that can happen - selecting a whole or half pill. Each branch has a probability of occurring (based on how many of each are in S), and a resulting situation (one less half pill, or one less whole pill and one more half pill). You multiply the probability of being in S by the probability of taking the branch, and add that to tomorrow's probability for S', the new situation that we just created.




Finally,




For each day, you can compute the expected number of whole pills (just multiply the number of whole pills in each situation by the probability of the situation). The total expected whole pills for the day will be the sum of all of these values. The same can be done for the half pills (and if you want to check your work, 2*expected_whole + expected_half should equal (30 - day), since that's how many total half-pills you still have left).




I can give you the Python code if you want. Not sure it can be spoilered (I've never learned how to have multi-line spoilers).



Python Code






share|improve this answer











$endgroup$










  • 3




    $begingroup$
    Rather than post code here, you should probably post it at (say) tio.run and link to it here - that way people can run it without having to download it and/or a python interpreter.
    $endgroup$
    – Rubio
    Aug 12 at 0:06






  • 2




    $begingroup$
    Thanks for the suggestion! Done.
    $endgroup$
    – hdsdv
    Aug 12 at 0:26










  • $begingroup$
    Re "Each branch has a probability of occurring": You may want to see my comment on the question.
    $endgroup$
    – msh210
    Aug 12 at 9:49










  • $begingroup$
    I think if John were half as likely to choose a half pill than a whole pill, that would have been specified. It seems like a pretty important detail to leave out when everything else was specified unambiguously. This wasn't presented as a "find the small detail that I intentionally left out" puzzle.
    $endgroup$
    – hdsdv
    Aug 12 at 10:15






  • 1




    $begingroup$
    @MSH210 et al. Thank you for your responses. I’m a newbie here, I’m sorry if this doesn’t comply to your definition of a puzzle. Thanks for your responses in any case. Regarding “remove a tablet perfectly randomly”: Perhaps I should have expressed it differently. I imagined that John tips a (half) tablet out of the box, and the chance that it is a whole one reflects the proportion of whole tablets in the box (so for example if there are 6 whole and 2 half tablets in the box, p(whole)=0.75, p(half)=0.25. I hope that makes ig clear.
    $endgroup$
    – David
    Aug 12 at 20:47















9













$begingroup$


It turns out that on the 14th (edited from 13th - I was using zero index before) day, you are more likely to pick a half pill than a whole pill. On that day, the expected number of whole pills is ~5.597 and the expected number of half pills is ~5.807.




To do this,




I just wrote a Python program that enumerates all the possible outcomes each day, along with the probability that each outcome would occur. To compute tomorrow's possible outcomes, you take each possible situation S from today and check each "branch" that can happen - selecting a whole or half pill. Each branch has a probability of occurring (based on how many of each are in S), and a resulting situation (one less half pill, or one less whole pill and one more half pill). You multiply the probability of being in S by the probability of taking the branch, and add that to tomorrow's probability for S', the new situation that we just created.




Finally,




For each day, you can compute the expected number of whole pills (just multiply the number of whole pills in each situation by the probability of the situation). The total expected whole pills for the day will be the sum of all of these values. The same can be done for the half pills (and if you want to check your work, 2*expected_whole + expected_half should equal (30 - day), since that's how many total half-pills you still have left).




I can give you the Python code if you want. Not sure it can be spoilered (I've never learned how to have multi-line spoilers).



Python Code






share|improve this answer











$endgroup$










  • 3




    $begingroup$
    Rather than post code here, you should probably post it at (say) tio.run and link to it here - that way people can run it without having to download it and/or a python interpreter.
    $endgroup$
    – Rubio
    Aug 12 at 0:06






  • 2




    $begingroup$
    Thanks for the suggestion! Done.
    $endgroup$
    – hdsdv
    Aug 12 at 0:26










  • $begingroup$
    Re "Each branch has a probability of occurring": You may want to see my comment on the question.
    $endgroup$
    – msh210
    Aug 12 at 9:49










  • $begingroup$
    I think if John were half as likely to choose a half pill than a whole pill, that would have been specified. It seems like a pretty important detail to leave out when everything else was specified unambiguously. This wasn't presented as a "find the small detail that I intentionally left out" puzzle.
    $endgroup$
    – hdsdv
    Aug 12 at 10:15






  • 1




    $begingroup$
    @MSH210 et al. Thank you for your responses. I’m a newbie here, I’m sorry if this doesn’t comply to your definition of a puzzle. Thanks for your responses in any case. Regarding “remove a tablet perfectly randomly”: Perhaps I should have expressed it differently. I imagined that John tips a (half) tablet out of the box, and the chance that it is a whole one reflects the proportion of whole tablets in the box (so for example if there are 6 whole and 2 half tablets in the box, p(whole)=0.75, p(half)=0.25. I hope that makes ig clear.
    $endgroup$
    – David
    Aug 12 at 20:47













9














9










9







$begingroup$


It turns out that on the 14th (edited from 13th - I was using zero index before) day, you are more likely to pick a half pill than a whole pill. On that day, the expected number of whole pills is ~5.597 and the expected number of half pills is ~5.807.




To do this,




I just wrote a Python program that enumerates all the possible outcomes each day, along with the probability that each outcome would occur. To compute tomorrow's possible outcomes, you take each possible situation S from today and check each "branch" that can happen - selecting a whole or half pill. Each branch has a probability of occurring (based on how many of each are in S), and a resulting situation (one less half pill, or one less whole pill and one more half pill). You multiply the probability of being in S by the probability of taking the branch, and add that to tomorrow's probability for S', the new situation that we just created.




Finally,




For each day, you can compute the expected number of whole pills (just multiply the number of whole pills in each situation by the probability of the situation). The total expected whole pills for the day will be the sum of all of these values. The same can be done for the half pills (and if you want to check your work, 2*expected_whole + expected_half should equal (30 - day), since that's how many total half-pills you still have left).




I can give you the Python code if you want. Not sure it can be spoilered (I've never learned how to have multi-line spoilers).



Python Code






share|improve this answer











$endgroup$




It turns out that on the 14th (edited from 13th - I was using zero index before) day, you are more likely to pick a half pill than a whole pill. On that day, the expected number of whole pills is ~5.597 and the expected number of half pills is ~5.807.




To do this,




I just wrote a Python program that enumerates all the possible outcomes each day, along with the probability that each outcome would occur. To compute tomorrow's possible outcomes, you take each possible situation S from today and check each "branch" that can happen - selecting a whole or half pill. Each branch has a probability of occurring (based on how many of each are in S), and a resulting situation (one less half pill, or one less whole pill and one more half pill). You multiply the probability of being in S by the probability of taking the branch, and add that to tomorrow's probability for S', the new situation that we just created.




Finally,




For each day, you can compute the expected number of whole pills (just multiply the number of whole pills in each situation by the probability of the situation). The total expected whole pills for the day will be the sum of all of these values. The same can be done for the half pills (and if you want to check your work, 2*expected_whole + expected_half should equal (30 - day), since that's how many total half-pills you still have left).




I can give you the Python code if you want. Not sure it can be spoilered (I've never learned how to have multi-line spoilers).



Python Code







share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 12 at 1:00

























answered Aug 11 at 23:19









hdsdvhdsdv

6091 silver badge9 bronze badges




6091 silver badge9 bronze badges










  • 3




    $begingroup$
    Rather than post code here, you should probably post it at (say) tio.run and link to it here - that way people can run it without having to download it and/or a python interpreter.
    $endgroup$
    – Rubio
    Aug 12 at 0:06






  • 2




    $begingroup$
    Thanks for the suggestion! Done.
    $endgroup$
    – hdsdv
    Aug 12 at 0:26










  • $begingroup$
    Re "Each branch has a probability of occurring": You may want to see my comment on the question.
    $endgroup$
    – msh210
    Aug 12 at 9:49










  • $begingroup$
    I think if John were half as likely to choose a half pill than a whole pill, that would have been specified. It seems like a pretty important detail to leave out when everything else was specified unambiguously. This wasn't presented as a "find the small detail that I intentionally left out" puzzle.
    $endgroup$
    – hdsdv
    Aug 12 at 10:15






  • 1




    $begingroup$
    @MSH210 et al. Thank you for your responses. I’m a newbie here, I’m sorry if this doesn’t comply to your definition of a puzzle. Thanks for your responses in any case. Regarding “remove a tablet perfectly randomly”: Perhaps I should have expressed it differently. I imagined that John tips a (half) tablet out of the box, and the chance that it is a whole one reflects the proportion of whole tablets in the box (so for example if there are 6 whole and 2 half tablets in the box, p(whole)=0.75, p(half)=0.25. I hope that makes ig clear.
    $endgroup$
    – David
    Aug 12 at 20:47












  • 3




    $begingroup$
    Rather than post code here, you should probably post it at (say) tio.run and link to it here - that way people can run it without having to download it and/or a python interpreter.
    $endgroup$
    – Rubio
    Aug 12 at 0:06






  • 2




    $begingroup$
    Thanks for the suggestion! Done.
    $endgroup$
    – hdsdv
    Aug 12 at 0:26










  • $begingroup$
    Re "Each branch has a probability of occurring": You may want to see my comment on the question.
    $endgroup$
    – msh210
    Aug 12 at 9:49










  • $begingroup$
    I think if John were half as likely to choose a half pill than a whole pill, that would have been specified. It seems like a pretty important detail to leave out when everything else was specified unambiguously. This wasn't presented as a "find the small detail that I intentionally left out" puzzle.
    $endgroup$
    – hdsdv
    Aug 12 at 10:15






  • 1




    $begingroup$
    @MSH210 et al. Thank you for your responses. I’m a newbie here, I’m sorry if this doesn’t comply to your definition of a puzzle. Thanks for your responses in any case. Regarding “remove a tablet perfectly randomly”: Perhaps I should have expressed it differently. I imagined that John tips a (half) tablet out of the box, and the chance that it is a whole one reflects the proportion of whole tablets in the box (so for example if there are 6 whole and 2 half tablets in the box, p(whole)=0.75, p(half)=0.25. I hope that makes ig clear.
    $endgroup$
    – David
    Aug 12 at 20:47







3




3




$begingroup$
Rather than post code here, you should probably post it at (say) tio.run and link to it here - that way people can run it without having to download it and/or a python interpreter.
$endgroup$
– Rubio
Aug 12 at 0:06




$begingroup$
Rather than post code here, you should probably post it at (say) tio.run and link to it here - that way people can run it without having to download it and/or a python interpreter.
$endgroup$
– Rubio
Aug 12 at 0:06




2




2




$begingroup$
Thanks for the suggestion! Done.
$endgroup$
– hdsdv
Aug 12 at 0:26




$begingroup$
Thanks for the suggestion! Done.
$endgroup$
– hdsdv
Aug 12 at 0:26












$begingroup$
Re "Each branch has a probability of occurring": You may want to see my comment on the question.
$endgroup$
– msh210
Aug 12 at 9:49




$begingroup$
Re "Each branch has a probability of occurring": You may want to see my comment on the question.
$endgroup$
– msh210
Aug 12 at 9:49












$begingroup$
I think if John were half as likely to choose a half pill than a whole pill, that would have been specified. It seems like a pretty important detail to leave out when everything else was specified unambiguously. This wasn't presented as a "find the small detail that I intentionally left out" puzzle.
$endgroup$
– hdsdv
Aug 12 at 10:15




$begingroup$
I think if John were half as likely to choose a half pill than a whole pill, that would have been specified. It seems like a pretty important detail to leave out when everything else was specified unambiguously. This wasn't presented as a "find the small detail that I intentionally left out" puzzle.
$endgroup$
– hdsdv
Aug 12 at 10:15




1




1




$begingroup$
@MSH210 et al. Thank you for your responses. I’m a newbie here, I’m sorry if this doesn’t comply to your definition of a puzzle. Thanks for your responses in any case. Regarding “remove a tablet perfectly randomly”: Perhaps I should have expressed it differently. I imagined that John tips a (half) tablet out of the box, and the chance that it is a whole one reflects the proportion of whole tablets in the box (so for example if there are 6 whole and 2 half tablets in the box, p(whole)=0.75, p(half)=0.25. I hope that makes ig clear.
$endgroup$
– David
Aug 12 at 20:47




$begingroup$
@MSH210 et al. Thank you for your responses. I’m a newbie here, I’m sorry if this doesn’t comply to your definition of a puzzle. Thanks for your responses in any case. Regarding “remove a tablet perfectly randomly”: Perhaps I should have expressed it differently. I imagined that John tips a (half) tablet out of the box, and the chance that it is a whole one reflects the proportion of whole tablets in the box (so for example if there are 6 whole and 2 half tablets in the box, p(whole)=0.75, p(half)=0.25. I hope that makes ig clear.
$endgroup$
– David
Aug 12 at 20:47

















draft saved

draft discarded
















































Thanks for contributing an answer to Puzzling Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fpuzzling.stackexchange.com%2fquestions%2f87023%2fbox-of-tablets-whole-or-broken-solution-required%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form