# Find the number of apples [duplicate]

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

• What happens if you start with one apple? – Arnav Borborah Mar 23 '18 at 18:55
• 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. – Armin Mar 23 '18 at 18:56
• Differences in the framing story notwithstanding, this is the same underlying puzzle - and this answer gives the solution for the general case. – Rubio Mar 23 '18 at 19:07
• Sigh.. Just finished my answer and pressed on Post answer, bam duplicated mark.. Here is my Java script with the result as output. – Kevin Cruijssen Mar 23 '18 at 19:09

## 1 Answer

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,Apples0,01,12,33,74,155,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

• 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... – Daniel Schepler Mar 23 '18 at 19:12
• Right, so this question literally wanted me to waste time find a answer that is not realistic. – Armin Mar 23 '18 at 19:20