# The story of green apples and red herrings

Let's say we are in a magic land with lots of fantastical animals and plants and whatever...
Imagine you have way too much time, really like apples and love collecting and growing them.
In fact, there are two rare kinds of apples and their colours are blue and green. 

Just by looking at your table, you can easily tell that the number of blue apples is not a lot more than the number of green apples; let's say less than 10 times.
From what you've red in your spellbook, 5 out of 6 blue apples are poisonous. I would take care of that. You don't have to, just saying. Anyway, you go ahead and add one blue apple, which is your favourite kind.
As a magician (did I forget to mention that?), you now use a very old spell that doubles the number of green apples immediately.

Next, you feel like adding another blue apple right after you cautiously use that old spell again but this time for both kinds at once (you are a very audacious person).

magic sound

You totally underestimated the power of this spell and you can feel that your body can't take such strong magic easily. You accidentally drop your wand, which is taking action on its own and changes the colour of one apple and also scorches your hat. But no problem, the hat was kind of maroon anyway.
Left with two kinds of apples and a burnt hat, you divide the bigger group in half. Now you are ready and decide to eat one of each kind.

eating sound

If done correctly you should have the same number of green and blue apples now. I'm wondering how much money you could get by selling all of them...

By the way, look at all those beautiful colours! Wait...take a few seconds...

How can this be real?

I think the question is "Given the described operations and the final assertion that there are the same number of green and blue apples, how many green apples and blue apples did you start with?" – apsillers

♫ Math, huh, yeah! What is it good for, absolutely nothing ♫
I will also accept the mathematical solution (for the sake of Emrakul - may God rest his soul).
Note: apples are integers and cutting them is not allowed.

• Maybe some people will reverse their downvotes when they realise this is a real puzzle with a unique answer? Feb 1, 2015 at 15:47
• ...and maybe because it was extremely hard to write this riddle! It is possible to solve it even without all this mathematical magic the other guys used. It took me a lot of time to make it work like this. Feb 1, 2015 at 16:23
• +10/-13 for anyone that can't see Feb 7, 2015 at 21:23
• is there a difference between dividing the bigger group in half and dividing it in two? Mar 5, 2018 at 18:48

## 5 Answers

I'm going on from @Togashi's answer, which seems to be mostly correct except that he's overlooked one possibility. Anyone who's seen fallacious proofs such as this one, or who knows about pathological (often trivial) examples in pure mathematics, will know

not to exclude the case $n=0$ unless you're specifically told $n$ is nonzero.

This is why Togashi's statement

at this point we have $\frac{n}{4}$ green apples and $6n$ blue apples. This means we have 24 times as many blues and greens, so that can't be true [because we have the same number of blues and greens]

immediately rang warning bells for me. Here's my solution.

Let $(G,B)$ denote the ordered pair (number of green apples, number of blue apples).

Just by looking at your table, you can easily tell that the number of blue apples is not a lot more than the number of green apples; let's say less than 10 times.

$(G,B)=(0,0)$. [Lynch mob!, division by 6 is optional ;)]

you go ahead and add one blue apple [...] you now use a very old spell that doubles the number of green apples immediately.

$(G,B)=(0,1)$.

you feel like adding another blue apple right after you cautiously use that old spell again but this time for both kinds at once

$(G,B)=(0,3)$.

your wand, which is taking action on its own and changes the colour of one apple

$(G,B)=(1,2)$.

you divide the bigger group in half

$(G,B)=(1,1)$.

you [...] eat one of each kind

$(G,B)=(0,0)$ again!

If done correctly you should have the same number of green and blue apples now. I'm wondering how much money you could get by selling all of them...

The answer is

0 pounds, dollars, euros, deutschmarks, francs, rubles, tenges, zlotys, or any other currency you care to mention.

• Well done! That's the only way to use all the clues correctly. Following your calculation shows that there is always an absolute way. If somebody started with any number of apples, it would cause the division by 6 to be not optional. Also the "random" change of one apple is clearly defined here :) Feb 1, 2015 at 14:23
• @Avigrail Thanks for putting me past 4000 points! :-) Now I'm a 'trusted user' ... oh the irony ... Feb 1, 2015 at 15:46
• Is "less than 10 times more" intended to be interpreted in the sense that 0 is less than 10 times more than 0 because $\exists x<10$ such that $0 = 0 + x0$?
– h34
Feb 2, 2015 at 0:59
• @h34 Yes, you could say it like that I suppose. you can easily tell [...]. I like to make fun of my customers :) Feb 4, 2015 at 7:00

Assuming I'm interpreting all this correctly and the bits that sound optional really aren't, it's not too hard to start at the end and work backward math-wise.

At the end of the story, you end up with $n$ each of green and blue apples. So before you ate one of each, you have $n+1$ of each.

The next step going backward is the halving of the larger group, which will result in one side doubling in our backwards work. The only other operations we'll perform on the green apples will be adding or removing one for the random color switch and halving for each of the two times the number of green apples was doubled. If the green group was larger at this point, we'll have an even number flipped to odd with the color change, which results in a non-integer result for the starting number of green apples. Therefore, the blue group must have been larger. At this point, we had $n+1$ green apples and $2n+2$ blue.

The unspecified color swap introduces a split in the possibilities. Before it we either had $n+2$ green and $2n+1$ blue with a green being swapped to blue, or $n$ green and $2n+3$ blue with an opposite swap.

Taking away a blue for the one that was added before that step gives us either $n+2$ green and $2n$ blue, or $n$ green and $2n+2$ blue.

At this point, both piles were doubled, so both are halved. We have $\frac{n+2}{2}$ green and $n$ blue, or we have $\frac{n}{2}$ green and $n+1$ blue.

Another halving for the greens puts us at $\frac{n+2}{4}$ green and $n$ blue or $\frac{n}{4}$ green and $n+1$ blue.

Take back the extra blue we put in, and you arrive at $\frac{n+2}{4}$ green and $n-1$ blue or $\frac{n}{4}$ green and $n$ blue.

Now the only thing left is to multiply the blues by 6, as I assume the bit about poisoning means you threw out 5/6 of the blue apples. This puts us at either $\frac{n+2}{4}$ green and $6n-6$ blue or $\frac{n}{4}$ green and $6n$ blue. Here's where we can use the initial constraint of starting with less than 10 times as many blues as greens.

If the swap was from blue to green, at this point we have $\frac{n}{4}$ green apples and $6n$ blue apples. This means we have 24 times as many blues and greens, so that can't be true. The swap was from green to blue, giving us $\frac{n+2}{4}$ green and $6n-6$ blue apples at the beginning. Using $k=\frac{n+2}{4}$, $n=4k-2$. So we have $k$ green apples and $24k-18$ blue apples. If $k$ is 2, we started with 2 green and 30 blue, which again violates the initial condition. However, starting with 1 green and 6 blue apples works.

Run through with 1 green and 6 blue apples, and you end up with 2 each of blue and green. However, let's assume the doubling spell creates blue apples with the same poison status as the ones you had before you used it. The blue apple you added could be poisoned and subsequently doubled, and both the second added blue and the green one that was color-swapped to blue could be poisoned. So when you get to the point of halving your number of blue apples, there is a $\frac{1}{216}$ chance none of your blues are poisonous, $\frac{10}{216}$ you have 1 poisonous blue, $\frac{30}{216}$ you have 2, $\frac{50}{216}$ you have 3, and $\frac{125}{216}$ you have 4.

Let's further assume that the half of the blue bunch to discard was chosen randomly. This gets very scribbly on my paper, but at the end of it we find there's a $\frac{17}{54}$ chance you have 1 poisoned apple in the final group, a $\frac{23}{48}$ chance you have 2, and a $\frac{55}{432}$ chance you have 3. Finally, assuming the apple to eat among that group is again chosen randomly, we end up with a $\frac{716}{1296}$, or roughly 55%, chance you are now poisoned. Hope you're feeling lucky.

Case 2: You didn't divide by 6

It's also apparently possible that you didn't divide the blue apples by 6. This takes things from a single solution to an infinite number of solutions. Everything is the same as in the previous, except we get to the point where we have either $\frac{n+2}{4}$ green and $n-1$ blue or $\frac{n}{4}$ green and $n$ blue, depending on the direction of the color switch.

If a green apple was turned blue, we're in the first case. We can use a similar substitution with $k=\frac{n+2}{4}$ to find that we started with $k$ green and $4k-3$ blue apples. This passes the initial condition for all positive integers $k$.

If a blue apple was turned green, we're in the second case. Even easier substitution this time, $k=\frac{n}{4}$ means we started with $k$ green and $4k$ blue apples. Once again, this works for all positive integers $k$.

tl;dr: You started with 1 green and 6 blue apples. Assuming perfect duplication and no checking of added blue apples for poison, you have a 55% chance of now being poisoned.

Alternatively, you started with $k$ green and either $4k$ or $4k-3$ blue. You are more likely to be poisoned in these cases.

• Just realized I forgot a second added blue apple in my calculations of your poison chances. Recalculating now, will edit when I'm done. Jan 22, 2015 at 21:09
• I can see a lot of correct stuff in your answer, nice :) I'm glad that I managed to make you work on this! Jan 22, 2015 at 21:25
• You should have a second look at your solution ;) Jan 29, 2015 at 9:44
• If that added second case is what you were looking for, that takes the puzzle from a nice single solution to messy infinite solutions. If you're looking for "how can this be real", a single solution answers that. This updated answer is more "what are all the possible ways this could be real". Jan 29, 2015 at 15:47
• Ok, you found out there are two cases which must either be true. Why not just equalize them? Jan 30, 2015 at 13:53

Work backwards. X = green, Y = blue. X is the larger half.

If a blue apple was changed to green

x = y as initial condition. Both apples had one eaten, therefore x + 1 = y + 1.

X was halved, so to reverse it we multiply. 2x + 2 = y + 1.

Reverse the color change, resulting in 2x + 1 = y + 2.

You added one blue apple, so we subtract 1 to get 2x + 1 = y + 1.

Then, both sides were multiplied by 2 (so we divide) and we get (2x + 1)/2 = (y + 1)/2.

Let's even it out a bit. Multiply the 2 on the Y side to the X side, giving us 2x + 1 = y + 1

Now we see that the green apples were doubled prior to that, so divide the x side again; however, we want to avoid fractions, so lets immediately multiply everything by 2 and get rid of the denominator. This gives us 2x + 1 = 2y + 2.

Finally, there was the 1 blue apple we added right at the start; subtract this from the y side. Now we have 2x + 1 = 2y + 1. (Case 1)

Following the same process, but with the assumption of the color changing from green to blue, our final result (If i did my math right) is (2x + 3)/2 = y - 2 (Case 2)

In case 1: Therefore, you started with the same amt of blue and green apples (which is wrong since the question states that there were more green apples) - we move to case 2.

In Case 2: minimum of Y = 2 (since y - 2 cannot be negative). If we started with Y = 2, we would end up with [2(0) + 3]/2 on X side (which doesn't make sense; therefore, we also get rid of "exactly 2" Y case. In fact, we can see that in any scenario where we start with an even number of Y, X side cannot be divided by 2 evenly, so we can reason that you MUST start Y with minimum 3, but in increments of 2, such that we always start Y with an odd number of minimum 3. You must also notice however, that 2Y is always an even number (anything * 2 is even). If X = y, and 2X is also always even, then 2x + 3 is always odd! Uh oh, this is a problem. If 2x + 3 is always odd, you can never divide it by 2 evenly!

Therefore, the final answer to the actual question that was asked ("How can this be real") is that IT IS NOT REAL.

• I'm a jerk but not a troll my friend :) Jan 22, 2015 at 21:38
• Then I probably did my math wrong ._.
– Aify
Jan 22, 2015 at 21:39

Here is one way it could work:

Begin with 3 green apples and 12 blue apples.

This meets the condition that there are less than 10 times the number of blue apples than green apples.

Add one blue apple:

We now have 3 green apples, 13 blue apples

Double the number of green apples:

We now have 6 green apples, 13 blue apples

Use the doubling spell now on all the apples:

We now have 12 green apples, 26 blue apples

Add one blue apple:

We now have 12 green apples, 27 blue apples

One apple changes colour:

A blue apple turns green, we now have 13 green apples, 26 blue apples

Divide the bigger group in half:

We now have 13 green apples, 13 blue apples

You eat one of each colour:

There are now 12 green apples, 12 blue apples, and maybe you have been poisoned.

• "A blue apple turns green" why not the other way round? Jan 27, 2015 at 14:28
• I thought you were just after the way(s) that worked?! (If the other way around, we would not end up with an even number of green and blue apples.)
– Ali
Jan 27, 2015 at 14:38
• Maybe it convinces you that you didn't divide by 6. Once you have the correct answer, you will see that dividing by 6 is not necessary. In your current solution it would make a big difference :) Jan 27, 2015 at 14:50
• Your comment makes no sense to me sorry, so I look forward to seeing the solution.
– Ali
Jan 27, 2015 at 18:53
• I will try again for you :D You can see that there is one step that is dividing the number of blue apples by 6. Others found out about that already...at the same time, it seems that the division by 6 is kind of optional. Think about how this is possible. Jan 27, 2015 at 19:02

The way it is possible is that:

You changed the color of one of the apples to or from another color other than green/blue.

Explanation:

Assumption 1:

In order for all the color references to have meaning (red, maroon, beautiful colors), the apple color change must have changed color from green/blue to not green/blue, or not green/blue to green/blue.

Assumption 2:

A blue apple is added "right after" the second doubling. However, in the story a color change happens during this doubling (or right after). This assumption will be that the blue is added after the color change.

Start:

At the end you have the same number of green and blue apples, $G$ = $B$, original values. Before that, you eat one of each kind. $G+1$ greens and $B+1$ blues. Then before this, the bigger group is divided in half.

Branch 1:

First assume green was the bigger half. There are now $2G+2$ greens. A blue is added (subtracted) here (see assumption 2). There are now $B$ blues. Either a green/blue is added here or taken away (see assumption 1).

Branch 1.1:

Green added (subtracted): There is now $2G+1$ greens. Both groups are doubled (halved). This is not possible (Green= $G+1/2$), end of branch.

Branch 1.2:

Blue added (subtracted): There are now $B-1$ blues. Both groups are halved. $(B-1)/2$ blues and $G+1$ greens. Greens doubled (halved) = $(G+1)/2$. A blue is added(subtracted), $(B-3)/2$ blues. Not equal for any value of $B$ (same as $G$), end of branch.

Branch 1.3:

Green subtracted (added): There are now $2G+3$ greens. This can't be halved (same as 1.1), end of branch.

Branch 1.4:

Blue subtracted (added): There are now $B+1$ blues. Both groups are halved. $(B+1)/2$ blues and $G+1$ greens. Greens doubled (halved) = $(G+1)/2$. A blue is added (subtracted), $(B-1)/2$. Not equal for any value of $B$ (same as $G$), end of branch.

Branch 2:

First assume blue was the bigger half. There are now $2B+2$ blues. A blue is added (subtracted) here (see assumption 2). There are now $2B+1$ blues and $G+1$ greens. Either a green/blue is added here or taken away (see assumption 1).

Branch 2.1:

Green added (subtracted): There is now $G$ greens. Both groups are doubled (halved). Blue is at $2B+1$ so it can't be halved, end of branch.

Branch 2.2:

Blue added (subtracted): There are now $2B$ blues. Both groups are halved. $B$ blues and $(G+1)/2$ greens. Greens doubled (halved) = $(G+1)/4$. A blue is added(subtracted), $B-1$ blues. Set two equations equal, $G,B=5/3$, this isn't possible so end of branch.

Branch 2.3:

Green subtracted (added): There are now $G+2$ greens. Blue is at $2B+1$ so it can't be halved, end of branch.

Branch 2.4:

Blue subtracted (added): There are now $2B+2$ blues. Both groups are halved. $B+1$ blues and $(G+1)/2$ greens. Greens doubled (halved) = $(G+1)/4$. A blue is added (subtracted), Set two equations equal, $G,B=1/3$, this isn't possible so end of branch.

Takeaway:

For branch 1 and 2, if not using Assumption 1 (color change for non green/blue), that means that both green and blue either go up or down by 1 and this will always make the "double both" stage (divide both by 2) fail.

Since none of these work, assumption 2 is probably wrong but I don't feel like doing this again without confirmation.

• There are some correct things in your answer. In general, it is wrong. I can assure you, there is a way that works! Jan 25, 2015 at 9:13