# 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

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