Let's say I have 6 colored pencils: Pink, Purple, Yellow, Red, Blue, and Green.
I want to fill a 25-line piece of paper with text. Each line has to be one color only.
Each new line has to be a different color than the previous line. That is the only stipulation.
How many pieces of paper could I produce with a unique sequence of colors?
EDIT: Of course, this could be visualized many different ways, besides text on paper. In a nutshell, I'm looking for how many sequences of 25 items from a pool of 6 different items, where the next item in the list is different from the previous one.
Red, green, blue, red, green, blue, red
Red, green, blue, red, green, blue, green
Red, green, blue, red, green, red, blue
Red, green, blue, red, green, red, green
Red, green, blue, red, blue, red, blue
Red, green, blue, red, blue, red, green
On and on... see what I mean? See the pattern?
Ok Plato, I see how you got the 6 at least. In the attached image, I show a simplified version of the problem: A pool of 3 items in 5 slots. My drawing is all possibilities starting with item 1. The total number of possibilities would include a similar tree for sequences starting with 2, and then 3. The total number of sequences [paths through the tree] is equal to the number of nodes on the bottom row, which is 16 in this tree. Therefore, the total answer to this one is 3 * 16 = 48. Since my original puzzle involves 6 items, there will be 6 of these trees. That easily explains the 6 in your answer.
Now check out when I add more items:
It appears that at each depth, we get the number of items to the depth-th power...
Row 1 = (items-1) ^ (Row-1)
Row 2 = (items-1) ^ (Row-1)
Row 3 = (items-1) ^ (Row-1)
In my first tree, with 3 items:
Row 1 = (3-1) ^ (1-1) = 2 ^ 0 = 1 node
Row 2 = (3-1) ^ (2-1) = 2 ^ 1 = 2 nodes
Row 3 = (3-1) ^ (3-1) = 2 ^ 2 = 4 nodes
Row 4 --> 8 nodes
Row 5 --> 16 nodes
And this works out for that second tree as well:
Row 1 = (4-1) ^ (1-1) = 3 ^ 0 = 1 node
Row 2 = (4-1) ^ (2-1) = 3 ^ 1 = 3 nodes
Row 3 = (4-1) ^ (3-2) = 3 ^ 2 = 9 nodes
Ok! So this seems to work out! Amazing how drawing + charting can be so helpful!
My answer will rely on the equation:
N = (items-1) ^ (slots-1)
So since I wanted to find the total number of sequences you could get from 6 items in 25 slots:
N = (6-1) ^ (25-1) = 5 ^ 24
And since there are six trees, the answer will be 6 times this, or 6 x 5^24 -- which is the answer you provided!
Thanks for helping me understand this! Unfortunately, I can't write a program to quickly brute-force 358 quadrillion possibilities, but at least I know now to search for a better algorithm for the problem I'm having (and needed this solution for).
How many sequences of items from a pool of different items, where the next item in the list is different from the previous one?
The answer is .
Look at new example. A pool of 3 items in 5 slots. Here