Grandma Troll Problem

You are on your way to visit your grandma, and you have to cross seven bridges, each with a troll under them. You want to give your grandma two cakes. Whenever you cross a bridge, you must pay the troll half of your cakes. As he is nice, he will give you back one cake. How many cakes should you head out of the house with?


The answer is 2.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

18 solutions

Colin Carmody
Apr 14, 2015

It is best to start with the last troll. If you need 2 cakes for grandma, and he gives you back 1, then 1/2 of the cakes = 1 cake, so you should get to the last troll with 2 cakes.

You can repeat this with the other 6 trolls to find that you only need 2 cakes to start with.

Here is how you can check your work mathematics:

With 2 cakes,

Troll 1: 2 ÷ 2 + 1 = 2 2 ÷ 2 + 1 = 2

Troll 2: 2 ÷ 2 + 1 = 2 2 ÷ 2 + 1 = 2

Troll 3: 2 ÷ 2 + 1 = 2 2 ÷ 2 + 1 = 2

Troll 4: 2 ÷ 2 + 1 = 2 2 ÷ 2 + 1 = 2

Troll 5: 2 ÷ 2 + 1 = 2 2 ÷ 2 + 1 = 2

Troll 6: 2 ÷ 2 + 1 = 2 2 ÷ 2 + 1 = 2

Troll 7: 2 ÷ 2 + 1 = 2 2 ÷ 2 + 1 = 2

And you have your 2 2 cakes left for granny!

The problem stated you would need 2 cakes for grandma. Nothing has been said about having exactly 0 cakes after giving 2 cakes to her.

Patrick Engelmann - 6 years, 1 month ago

This is the solution I ended up using. I tried to start at the first troll with a number like 100. Then soon ran into odd numbers. I tried 128. That didn't work either. Then I tried started at the last troll and soon realized, that in order to end up with 2 cakes, the last troll would have given 1 cake back to go from 1 to 2. But he took half of them to go from 2 to 1.

Frank Rodriguez - 6 years, 2 months ago

Log in to reply

but if you start with none and he already has a cake...

malachi hadaway - 6 years, 1 month ago

Log in to reply

You cannot start with none because the 6th troll gave you a cake... so you must have at least a cake

Ernesto Civello - 6 years, 1 month ago

Log in to reply

@Ernesto Civello I am sorry but aren't we all thinking of her journey forward?what of her return

Nehemiah Osei - 6 years ago

Log in to reply

@Nehemiah Osei She must have 258 cakes. This way when she gets to the final troll, she has 6 cakes. He takes half and gives her one. She now has 4. Gives jer

grandma 2 and can return with the other two

Nehemiah Osei - 6 years ago

@Ernesto Civello they all give you a cake

malachi hadaway - 6 years, 1 month ago

That's also the solution i had used..it took me time to realize it.

Steven Sison - 6 years, 1 month ago

if i am understand u q (transltion) in last brigde u need 6 because 6/2=3 and -1=2 then and in 6 bridge u need 12 and >>>>>* to 5ridge u need 24 >>>*> then last 243 or more

Patience Patience - 5 years, 1 month ago

if you don't want a troll to eat you, they better get something each time and not figure out any trick before the last bridge as they may text the next troll. So take enough to give each at least half your cakes (nobody wants crumbs) to each troll and so that each gets something. I think you would have 128-65- 33-17-9-5-3-2. The trolls get 63-32-16-8-4-2-1 which is a difference of 2. Everbody happy!

Fiona Lyczynska - 3 years, 2 months ago

ughhh! I can't find a comment to say.

Am Kemplin - 3 days, 7 hours ago
Abhishek Sharma
Apr 14, 2015

Mathematical way of doing the problem.

Let N r {N}_{r} be the number of cakes I have after crossing r r bridges.

N 0 = x N 1 = x + 2 2 N 2 = x + 6 4 {N}_{0}=x\\{N}_{1}=\frac{x+2}{2}\\{N}_{2}=\frac{x+6}{4}

Similarly,

N r = x 2 + 2 r + 1 2 r {N}_{r}=\frac{x-2+{2}^{r+1}}{{2}^{r}} .

Therefore,

N 7 = x + 254 128 {N}_{7}=\frac{x+254}{128}

Given N 7 = 2 {N}_{7}=2

x + 254 = 256 x = 2 x+254=256\\x=2 .

Therefore, I must carry 2 cakes.

If you take half a cake, you will get almost 2 cakes after crossing all 7 bridges. The less you take, the more cake you will get.

Unless you have to give the troll whole cakes.

Sadi Wali - 6 years, 2 months ago

Log in to reply

Read the problem again. Trolls take HALF OF YOUR CAKES..

Brian Klein - 6 years, 1 month ago

The troll can't give you back cakes you haven't given him...

Pablo Perez - 6 years, 1 month ago

Log in to reply

its troll problem...not ours....:D :P

Muhammad Ahsan - 5 years, 5 months ago

If I take no-cakes, and the troll will give me a cake after I pay half of my cakes, then I still end up with cake...

Jamie Wood - 6 years, 1 month ago

Log in to reply

You gave nothing, so are you sure that the troll will let you go?

Cedric Magno - 6 years, 1 month ago

Log in to reply

@Cedric Magno I paid half of my cakes! That's the only condition...

Jamie Wood - 6 years, 1 month ago

Log in to reply

@Jamie Wood If 0 has a half, it shall be

Cedric Magno - 6 years, 1 month ago

Yes, but you need to end up with two.

Whitney Clark - 5 years, 5 months ago

Try again. You are to end up with two cakes, not "almost" two cakes.

Whitney Clark - 6 years, 1 month ago

awesome answer sadi

Muhammad Ahsan - 5 years, 5 months ago

in numerator it should be 2^(r+1)

Abhishek Sharma - 6 years, 1 month ago
Shubham Ghosh
Apr 14, 2015

I can not waste any cake,so I must take 2 cakes so that each time I give half of it(1) to the troll,no. of cakes remains the same, when he gives me one back.

2/2=1(I give half) 1+1=2(he gives one back) It remains the same.

Upvote please!!!!!!!!!

Moderator note:

This solution is incomplete. How would you know that the answer is only 2 2 and no other value satisfy the condition?

I think he meant working backwards

Daniel Chen - 6 years, 1 month ago

Not sure that the questions calls for a distinct answer.

Kian Stack - 6 years, 2 months ago

3/2-1=.5,I lose .5

Shubham Ghosh - 6 years, 2 months ago

See my answer below.

Michael Mendrin - 6 years, 1 month ago
Michael Mendrin
Apr 15, 2015

(Going backwards in time)

28) I give grandma 2 2 cakes, after leaving Troll 7 7 with them
27) Troll 7 7 gives back to me 1 1 cake
26) I had 1 1 cake after Troll 7 7 took half of what I had
25) Troll 7 7 takes 1 1 cake from me, half of the 2 2 I had
24) I left Troll 6 6 carrying 2 2 cakes....
23)...(repeat)




Hence, there is no other solution other than to start the trip with 2 2 cakes.

Bhavana Giri
Apr 15, 2015

backtracking is the most optimal way to solve this.

at 7th bridge after giving away half of what u had...u r left with 2 cakes

at 6th bridge suppose u have x cakes x/2 +1 = no. of cakes at the 7th bridge...here
x=2...hence 2 cakes at the 6 th bridge too

at 5 th bridge , say u have x cakes again x/2 +1= no .of cakes at 6 th bridge x/2+1 =2 .x=2 ; ; . ; similarly 2 cakes at every bridge results in 2 cakes at the end

Brent DeJong
Apr 19, 2015

You need 2. But on your way home, you get 1 cake after the first bridge, then 1.5 after the second bridge, then 1 3/4 after the third, then 1 7/8 after the fourth, etc. If there were countably infinite bridges to cross, you'd get back home with 2 cakes. (As it is, you only have 1 and 255/256ths cakes.)

You also get a quite interesting sequence of numbers if you want to give your grandmother 3 cakes. I'll leave that for the reader, though.

Brent DeJong - 6 years, 1 month ago
Gilbert Wells
Jan 18, 2020

You only need two cakes; all the trolls are a bit thick! (or just too generous!)

Naveen Meena
Dec 6, 2015

Let's he started with A cakes. So, After the first Bridge, he left with {A-A/2 +1} = {(A + 2)/1} After Second Bridge = (A+6) /4 After third Bridge = (A+14/8) So, we can see a pattern after crossing each Bridge= {(A + 2^ (n+1) - 2) / 2} where n is no. of bridges. so after 7 th Bridge, he should have 2 cakes. solve the equation you will get the answer

Tejaswy Teju
Apr 22, 2015

ans is 2......

Aakash Meshram
Apr 22, 2015

We need 2 cakes in the end, let the total no. of cakes be x, and we have 7 trolls which divide our no. of cakes by 2 and give one back, this implies the equation ((((((x/2 +1)/2 +1)/2 +1)/2 +1)/2+1)/2+1)/2+1= 2 Every time we subtract 1 from RHS we also multiply by 2, which gives us the final answer 2

Zi yang Lim
Apr 19, 2015

This troll isn't greedy at all!

Since he'll give you back 1 of your cakes whenever you cross a bridge, and you give him a 1/2 of all your cakes when you cross a bridge, you should bring 2. It' basic logic.

1st Troll : 1 cake given, 1 cake received

You can repeat this with the next 6 trolls

Or, you could put poison in the cakes :)

Konitham Krishna
Apr 19, 2015

Array yar ......every Indian solve this.

Ammar Elkhwesky
Apr 18, 2015

2 because when ever you give him half of your cakes he will give you a one back then your cakes are going to stay 2 for ever

Faisal Islam
Apr 18, 2015

Well every troll takes half of your cakes and gives u one more. So let's look at the last troll. How much cakes u need in order to have 2 cakes remaining? The answer is 2.... yeah have two and none of the trolls can have any net effect on ur number of cakes cuz they are so nice that if u havetwo cakes they give back what they took. So there it is- just go with two cakes and troll the trolls.

Richard Nitsche
Apr 17, 2015

We know that in the end we will have two cakes. We go backwards. We give the troll back his one cake he gave us out of niceness(-1). The troll gives us back half our cakes he took from us (Now we have 2 times the amount as before. Hence times 2). Repeat 6 more times. This can be written in a programmable for loop in any programming language.

x=2

for (i=0; i<7; i++)

  - x=(x-1)*2

Another solution is a recursive function:

x=number of cakes we want to give grandma

y=number of bridges we have to cross

f (x, y) will be defined as followed:

If y=0 we have reached grandma so f (x,0) will be x

Otherwise we call the function again with following parameters: f ((x-1)*2, y-1)

So for the start we have f (2,7)=f ((2-1)*2, 7-1) And so on.

Alessandro Segala
Apr 16, 2015

To solve this problem I thought backwards.

To have 2 cakes after crossing the last troll (#7!), how many cakes should I be carrying? The answer was 2: if I arrive with 2 cakes, I have to give him half of them (=1), and he gives me back 1 cake. This made me realize that, by going backwards, if I had two cakes with each troll I'd always keep all two of them.

Daniel Chen
Apr 15, 2015

working backwards, when you cross back to the 7th bridge, you subtract one cake:1, and then multiply that by two, so 2. it repeats so you need to start with 2 cakes.

Uraib Amar
Apr 15, 2015

Since it is half a cake, and the troll has to give you a full cake, you will get 2 cakes after crossing the bridge all 7 times. You start with half a cake , and then you get 1 cake back, so now you got 1 cake. Give half of that cake to troll on the next bridge, you would have 1.5 of a cake. Next bridge you would have 2. and so on and so on. The less cakes you take the more cakes you shall end up with. 2/2+1 is the equation.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...