Decoding and solving puzzles has been there since very early days of mankind. And that has played a crucial role in the evolution of human brain. In the beginning, nature alone used to throw up puzzles for human brain to solve, for its mere existence itself. However, as human brain became more refined in thinking, analysis, and logic, it started creating its own puzzles, as well. So, today we have man-made puzzles and riddles as well, though many a times inspired from real life scenarios. Thus, inspired by the important role of puzzles in human life, and how have they been approached and solved in different ways, here is an attempt to present a semi-formal approach of logic analysis and problem solving in decoding puzzles. It would be attempted by picking up various sets of puzzles.

Puzzle #1: There is a square-shaped magic pond, which doubles the flowers dipped into it. On the four corners of the pond are four temples. A devotee comes with some flowers. She dips them in the pond. Flowers get doubled. Then, she offers some of those flowers in the first temple. She then again dips the remaining flowers in the pond. Flowers again get doubled. She then offers the same number of flowers in the second temple, as she offered in the first temple. Again the remaining flowers are doubled, and the same number of flowers are offered in the third temple, as in the second temple. And finally, the remaining flowers are doubled for the last time, and all of them are offered in the fourth temple. Interestingly, the number of flowers offered in the fourth temple is also same as that in the third temple. So, what is the **minimum** number of flowers the devotee would have brought, and what is the number of flowers offered in each temple?

Now, there could be many approaches to solve this puzzle. Try solving it yourself before proceeding further to see the analysis.

The first attempt typically done to solve any puzzle is basically to understand the puzzle, by trying to observe and register some patterns about it. Same here. So, one would start trying with some numbers. Say she came with 1 flower, doubled it to 2, then offered 1, and continued so forth till fourth temple. But then, if the fourth temple is also offered with 1 flower, she would have 1 flower remaining with her. So, seems like the number of flowers brought and offered can’t be same. On further delving, there would be a realization that flowers offered need to be more than flowers brought, for it to reduce on consecutive iterations. Moreover, the flowers offered need to be less than twice the flowers brought, for the same reason. Given this understanding, one may try with next set of possible numbers as 2 flowers brought and 3 flowers offered. Not working. Then, with 3 flowers brought, either 4 or 5 flowers could be offered. Interestingly, with 3 flowers brought, and 4 flowers offered, all flowers get over in the second temple itself. And with 1 flower brought, and 2 flowers offered, all flowers were getting over in the first temple itself. Wow! There seems to be some pattern.

Now, one can approach this way, and finally get a solution. But as this is a trial and error kind of approach, computers are better in solving this. And a programmatic flow can be evolved for the same. And in that case, why only for a square pond? Why not an n-sided polygon pond with n temples? Great idea. And here is how the logic for that could be laid out:

solved = false; brought = 1; while (!solved) { for (offered = brought + 1; offered < 2 * brought; offered++) { if (solved = solve(n, brought, offered)) { printf("Min Brought: %d. Offered: %d\n", brought, offered); break; } } brought++; }

where the solve() function could be the puzzle iterator, as follows:

solve(n, brought, offered) { rem = brought; for (i = 1; i <= n; i++) { rem = 2 * rem - offered; } return (rem == 0) ? true : false; }

Why is the **minimum** number of flowers brought, is being discussed? This can be easily seen by replacing the while (!solved) by a while (1). And there would be a continuous listing of infinite solutions to this puzzle.

Furthermore, why does the magic pond only double? What if it makes it k-times? The above problem could be parameterized even for that to observe even more interesting patterns – left as an exercise for the reader.

Now, this was just one approach to solve the puzzle and without any hesitation could be called as the computer science approach.

What if one wants to do it without computer science fundae – computer science is only very recent, right? Yes, as mentioned earlier, there could be many more approaches to the problem. Computer Science is just an ease. Or, rather an approach of making ourselves easier by trying to offload our brain tasks to computers.

Just to demonstrate that there could be other approaches as well, one may take a mathematical approach using algebra to solve the same. Let ‘b’ be the (positive) number of flowers brought, and ‘o’ be the (positive) number of flowers offered. Then, using these two variables, one may form an equation as per the puzzle, and then solve it. It would turn out to be one linear equation in two variables, and hence offering infinite solutions, same as above.

Expecting an answer to the above puzzle. Just try it out and find out for yourself. And may be, using your own approach. And then don’t forget posting it below in the comment box.

Pingback: Magic Square | Playing with Systems

Jayasankar16x – 15y = 0 (x as flowers bought and y be the flowers offered)

flowers bought = 15

offered to each temple = 16

Pingback: Weighing Stones | Playing with Systems