So, I was puttering around with Python, trying to find patterns in the problem,
and hit upon a method for finding the answer. The only thing is, I have no clue how it works.
It's also kind of difficult to explain without using paper + pencil
(or whiteboard + marker, which is much cooler), but I gave it my best shot.
(If possible, view this email in a monospace font -- try copying and pasting into notepad)
* * *
In short,
If the answer has one digit, then there are 5 possibilities
1 + 1 + 1 + 1 + 1 = 5
If the answer has two digits, then there are 8 possibilities
1 + 2 + 2 + 2 + 1 = 8
If the answer has three digits, then there are 14 possibilities
2 + 3 + 4 + 3 + 2 = 14
Here are a bunch more possibilities:
1 1 1 1 1 = 5
1 2 2 2 1 = 8
2 3 4 3 2 = 14
3 6 6 6 3 = 24
6 9 12 9 6 = 42
9 18 18 18 9 = 72
18 27 36 27 18 = 126
27 54 54 54 27 = 216
54 81 108 81 54 = 378
If you notice, each number in the sequence is equal to the sum of numbers
that are to the left to the right on the row above it.
3 6 6 6 3
\ /
6 9 12 9 6
(9 is the sum of 3 and 6, for example)
So basically, this is like Pascal's triangle, except it's more a rectangle with
some fiddly bits.
* * *
If you're wondering what the numbers represent, they equal the number of
possibilities each branch in the tree has or the count of the number in the
final branch of the tree (that didn't make sense, did it).
An example (for three digits):
1 3 5 7 9
. 3 1 5 3 7 5 9 7 ,
1 5 . 3 3 7 1 5 5 9 3 7 7 . 5 9
Each layer represents the number of possibilities in the tree.
If there is only one digit, there's only
1 1 1 1 1 possibilities.
If there are two digits, there's
1 2 2 2 1
possibilities per branch.
However, there is exactly
1 one
2 threes
2 fives
2 sevens
and 1 nine
given two digits.
If there are three digits, there are
2 3 4 3 2
possibilities per branch.
However, there's
1 one
3 threes
4 fives
3 sevens
and 1 nine in that layer.
* * *
Isn't this weird?
-- Michael.