Home

Wednesday, April 7, 2010

A Heuristic and A Puzzle

A Heuristic is a “rule of thumb", an educated guess, an intuitive judgment or simply common sense. A heuristic is a general way of solving a problem.
- Wikipedia

There are few heuristics which I generally use while doing testing. One of them is “To solve a big problem let it divide it into smaller ones”. I learned this heuristic in one of the workshop by Pradeep Sir.

Recently when I visited the Blog of James Sir, I found a puzzle challenge. The Puzzle was:
Find the missing 13th number in this sequence:
77, 341, 923, 1547, 608, 2116, 377, 2263, 518, 1394, 3182, 1645, _____, 944, 4636 …”
I always love to play with numbers and so I thought to find the 13th number in the series.

My approach: I noted down the series in WordPad and started to apply different arithmetic operators. Nothing found. I left the exercise (Hopeless!!!!)
Next day I have started again from scratch. As I already played with them so I knew simple arithmetic operation would not help me. Then what should I do? How to find the missing number?
I was just gazing the numbers like an idiot and expecting them to tell me what the pattern hiding in the series is. At this moment, suddenly an idea came to my mind: Apply the heuristic which I learnt in the workshop.
To solve a big problem let it divide it into smaller ones
I was not sure that it will solve the problem, but there might be some logic which could help me to solve the problem. So I started to use the heuristic and I hit the Bull's Eye. After applying the heuristic, I not only got the answer but also found the two patterns in the series. The pattern in the series was awesome which is difficult to find by simply applying the arithmetic operations or any formula.
I am not solving the puzzle here so that you can find the solution of the problem with your own and share your approach of solving the problem here.

P.S.: I am posting the solution in comments section for those who want the solution of the puzzle but I wish you to try yourself before looking the solution.

1 comment:

Mohit said...

My Approach: In the series there are few large numbers so I decided to factorize them. After factorization I found the following
77 = 7*11,
341 =11*31,
923 = 13 * 71,
1547 = 17 * 13 * 7,
608 = 19 * 2 * 2 * 2 * 2 * 2,
2116 = 23 * 23 * 2 *2 ,
377 = 29 * 13,
2263 = 31 * 73,
518 = 37 * 7 * 2,
1394 = 41 * 17 *2,
3182 = 43 * 37 * 2,
1645 = 47 * 7 * 5,
x = y * z,
944 = 59 * 16,
4636 = 61 * 76
On rearranging the series it becomes
77 = 7*11,
341 =11*31,
923 = 13 * 71,
1547 = 17*91,
608 = 19 * 32,
2116 = 23*92,
377 = 29 * 13,
2263 = 31 * 73,
518 = 37 * 14,
1394 = 41 * 34,
3182 = 43 * 74,
1645 = 47 * 35,
x = y * z,
944 = 59 * 16,
4636 = 61 * 76
If you have noticed there are two patterns
(I) The first factors are prime numbers in continuous series i.e. 7, 11, 13, 17 and so on. Second factor is the reverse of next prime number.
It means y = 53 (the next prime number after 47) and z = 95 (reverse of next prime number i.e. 59)
Hence x = 5035
(II) First Factor is reverse of second factor of previous number in the series and second factor is reverse of first factor of next number.
It means y = 53 (reverse of 35) and z = 95 (reverse of 59)
Hence x = 5035