# Temple lake question

There is a flower garden, a lake and three temples. If we throw a flower into the lake, we will get back triple the number of flowers we threw in. A man wants to keep an equal number of flowers in all three temples.

He throws a certain number of flowers in the lake. He leaves part of the flowers that he got back at the first temple. He then throws all the rest in the lake and puts some in the second temple. Finally, he throws the leftovers in the lake and puts them all in the third temple.

How many flowers did he start out with, and how many flowers are in each temple?

Let's say the man threw $$x$$ flowers into the lake. Then he has $$3x$$ flowers and puts $$y$$ of them into the first temple, leaving him with $$3x-y$$ flowers.

He throws them in again, resulting in $$9x - 3y$$ flowers, and puts $$y$$ of them in the temple again, for $$9x - 4y$$ flowers.

He throws them in a third time resulting in $$27x - 12y$$ flowers, and puts $$y$$ of them in the temple, for $$27x - 13y = 0$$ flowers.

The smallest integer solution that will work here is

$$x = 13$$, $$y = 27$$, so the man had 13 flowers initially and put 27 flowers in each temple.

In general, this sort of problem is called an annuity problem, and has applications in finances when calculating amortization rates of mortgages (hence the term "annuity problem"). In the above example, an equivalent problem using loans would be that you have a debt of \$13 with an annual interest rate of 200% that you want to pay off in 3 years, which requires a payment of \$27 every year. To calculate the payments required, the following formula is used:

$$p = \frac{P(1+i)^n}{1 + (1+i) + (1+i)^2 + (1+i)^3 + \ldots + (1+i)^{n-1}} = \frac{P(1+i)^n i}{(1+i)^n - 1}$$

where $$p$$ is the periodic payment, $$P$$ is the initial principal amount, $$n$$ is the number of pay periods, and $$i$$ is the interest rate per pay period. In the problem statement above, $$i = 2$$ and $$n = 3$$, so the ratio of flowers put into each temple to initial flowers is 27/13 ($$p = \frac{P(2+1)^3(2)}{(2+1)^3 - 1} = \frac{54P}{26} = \frac{27}{13}P$$), which is consistent with what working it out manually gave us.

You'll notice with the above formula that any multiple of 13 flowers would work, if you put the same multiple of 27 flowers into each temple. If you allowed for fractional flowers, you could start with 1 flower and put 27/13 flowers into each temple and it would work out the same way.

• The set of all solutions is given by (x, y) = (13k, 27k) for any positive integer k. Sep 30 '15 at 5:43
• I'm writing up an expansion of my answer into the general class of problems of this type.
– user88
Sep 30 '15 at 5:45

A simpler approach is to start from the end:

$x$ flowers went to the third temple. So, $x$ flowers came out of the lake the third time, and ${1\over3}x$ flowers were thrown in the 3rd time.

$x$ flowers went to the second temple plus ${1\over3}x$ flowers that were thrown in the lake, that is ${4\over3}x$ flowers that came from the lake the second time, and therefore ${4\over9}x$ flowers were thrown in the second time.

$x$ flowers went to the first temple plus ${4\over9}x$ flowers that were thrown in the lake, that is ${13\over9}x$ flowers that came from the lake the first time, and therefore ${13\over27}x$ flowers were thrown in the first time.

Assuming flowers come in integer numbers, we have to multiply $x$ by $27$. Let's name $n = 27x$

The solution: $13n$ flowers were thrown in the lake, $39n$ came out, $27n$ went to the first temple, the remaining $12n$ were thrown back in the lake, $36n$ came out, $27n$ went to the second temple, the remaining $9n$ were thrown back in the lake, $27n$ came out, and all went to the third temple.

After trial & Error method i got this result!

suppose we have 6 flowers at start!

starting amount of flowers = 6.

among 6 we throw 3 flowers into lake,
so we have 3 + (3*3) = 12
from which we put 6 to first temple.
after that we have 6 flowers again ,
so again we throw 3 flowers into lake
so we have 3 + (3*3) = 12
and we put 6 onto second temple.
than we have 6 flowers, we through 0 flowers to lake
so we have 6 + (0x3) = 6
and put all 6 flowers on third temple and finally we have no flowers in hand.

• Does the lake add a triple amount or just turn the flowers thrown into triple the amount there?
– user88
Sep 30 '15 at 5:45
• As per question , we got triple amount of flower we throw into lake. Sep 30 '15 at 5:48
• Okay, I think I understand what your answer is doing now... but your answer is wrong because the man throws all the remaining flowers he still has into the lake after he puts some number of flowers into the temple.
– user88
Sep 30 '15 at 6:00
• ohh..! you're right Sep 30 '15 at 6:33

A slightly cheaper solution is in:

$$5$$ flowers.

Because:

For this solution, we don't throw all our flowers into the lake on the first throw - in fact we keep $$f$$ back. The maths goes:

f+k flowers -> f+3k
t in temple
f+3k-t in lake -> 3f+9k-3t
t in temple
3(3f+9k-4t)=t
9f+27k=13t

If $$f=0$$, then $$k=13$$ is the first solution, and we must start with $$13$$ flowers (and $$27$$ in each temple): 13->39->12->36->9->27->0.

But starting with $$5$$ and throwing $$4$$ into the lake (and $$9$$ in each temple), we have: 1+4>13->4->12->3->9->0.

Other solutions can be found from $$f+3k\equiv 0 \pmod {13}$$.