0 Members and 1 Guest are viewing this topic.

How many five digit integers satisfy the following:- All the digits are odd- The difference between adjacent digits is 2An example of such a number is 13535 or 57979

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 possibilities1 + 1 + 1 + 1 + 1 = 5If the answer has two digits, then there are 8 possibilities1 + 2 + 2 + 2 + 1 = 8If the answer has three digits, then there are 14 possibilities2 + 3 + 4 + 3 + 2 = 14Here are a bunch more possibilities:1 1 1 1 1 = 51 2 2 2 1 = 82 3 4 3 2 = 143 6 6 6 3 = 246 9 12 9 6 = 429 18 18 18 9 = 7218 27 36 27 18 = 12627 54 54 54 27 = 21654 81 108 81 54 = 378If 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 9Each layer represents the number of possibilities in the tree.If there is only one digit, there's only1 1 1 1 1 possibilities.If there are two digits, there's1 2 2 2 1possibilities per branch.However, there is exactly1 one2 threes2 fives2 sevensand 1 ninegiven two digits.If there are three digits, there are2 3 4 3 2possibilities per branch.However, there's1 one3 threes4 fives3 sevensand 1 nine in that layer.* * *Isn't this weird?-- Michael.