2
$\begingroup$

This question already has an answer here:

Suppose you have (N) number of apples in a basket. Each day you eat half of all apples plus half of one apple. After a year there are no more apples. How many apples did you start with?

Example: If you had 4 apples. 2 (Half of all) + 0.5(half of 1 apple) = 2.5 Now you have 1.5

$\endgroup$

marked as duplicate by Oray, APrough, Rubio Mar 23 '18 at 19:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ What happens if you start with one apple? $\endgroup$ – Arnav Borborah Mar 23 '18 at 18:55
  • $\begingroup$ 1 is for one day, he did this for 1 year. It can't be one. If it's one then he doesn't have any apple to eat for 364 days. $\endgroup$ – Armin Mar 23 '18 at 18:56
  • $\begingroup$ Differences in the framing story notwithstanding, this is the same underlying puzzle - and this answer gives the solution for the general case. $\endgroup$ – Rubio Mar 23 '18 at 19:07
  • $\begingroup$ Sigh.. Just finished my answer and pressed on Post answer, bam duplicated mark.. Here is my Java script with the result as output. $\endgroup$ – Kevin Cruijssen Mar 23 '18 at 19:09
0
$\begingroup$

This might be better suited for Mathematics.SE, but we can solve this fairly easily working backwards:

In the end, we have 0 apples. To get what we had the day before, add .5, then double it. This is the same as doubling the current amount, and adding 1. Working backwards from day 365, we notice a pattern:

Day,Apples
0,0
1,1
2,3
3,7
4,15
5,31
So, $T$ days before the end of the year, there are $2^T - 1$ apples left. That means, if I started a year before I ran out of apples, I would have started with $2^{365} - 1$ apples, which in decimal notation is:
75153362648762663292463379097258784876021841565066235862633311089030688803667470190838367948312598497021919231

$\endgroup$
  • $\begingroup$ In other words, if each apple has an average mass of 100g (from a quick Google), the total mass would be about 7.5 * 10^109 kg, much higher than the estimated mass of visible matter in the observable universe which according to Google is on the order of 10^53 kg... $\endgroup$ – Daniel Schepler Mar 23 '18 at 19:12
  • $\begingroup$ Right, so this question literally wanted me to waste time find a answer that is not realistic. $\endgroup$ – Armin Mar 23 '18 at 19:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.