Download Partitioning handout

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Mathematics of radio engineering wikipedia , lookup

Addition wikipedia , lookup

Location arithmetic wikipedia , lookup

Transcript
Irv Lubliner
Southern Oregon University
[email protected]
Food For Thought: A Partitioning Problem
● Consider the various ways that we can partition 3, leaving it alone or
writing it as the sum of smaller natural numbers: 3, 1+2, 2+1, 1+1+1
Change each addition sign to a multiplication sign: 3, 1x2, 2x1, 1x1x1
Sum those products, and we get 3 + 2 + 2 + 1 = 8.
================================================================
● Let’s perform the same process, starting with 5. We begin by listing the
ways that we can partition 5, leaving it alone or writing it as the sum of
smaller natural numbers: 5, 1+4, 4+1, 2+3, 3+2, 1+1+3, 1+3+1, 3+1+1, 1+2+2,
2+1+2, 2+2+1, 1+1+1+2, 1+1+2+1, 1+2+1+1, 2+1+1+1, 1+1+1+1+1
Change each addition sign to a multiplication sign: 5, 1x4, 4x1, 2x3, 3x2,
1x1x3, 1x3x1, 3x1x1, 1x2x2, 2x1x2, 2x2x1, 1x1x1x2, 1x1x2x1, 1x2x1x1,
2x1x1x1, 1x1x1x1x1
Sum those products, and we get 5 + 4 + 4 + 6 + 6 + 3 + 3 + 3 + 4 + 4 + 4 + 2 +
2 + 2 + 2 + 1 = 55.
================================================================
● You’ve seen what happens when we start with 3 or 5. Now, try to predict
what the final result will be if you start with 4, listing all of the ways that
4 can be partitioned (leaving it alone or writing it as the sum of smaller
natural numbers), changing addition signs to multiplication signs, and
adding the products.
Once you have made a prediction, carry out the process yourself and see
whether your prediction was close to the actual answer.
================================================================
● Assume someone has asked you to perform this same process, starting with
a specified natural number, N. Is there a way to predict the result
without actually writing all of the partitions, changing addition signs to
multiplication signs, finding the products, and adding them together? In
particular, can you determine the final result when N = 10?
START
B
A
F
D
C
E
G
L
J
H
I
K
M
If you can only move to adjacent hexagons and all moves must be rightward
(diagonal moves up or down are OK, as long as they are rightward), how many
different paths lead from “START” to each of the letters A, B, C, D, etc?
A____ B____ C____ D____ E____ F____ G____
H____ I____
J____ K____ L____ M____
Do the numbers that belong in the blanks above form a recognizable
sequence, one that you could continue without actually counting paths?
Let’s consider the paths from “START” to G. We will need to get down to the
bottom row at some point, and we get to decide if we will also include some
upward moves.
What if we include no upward moves? In that case, we have 4 choices about
where to come down. Thus, we have accounted for 4 of the possible paths.
What if we include a single upward move from A to B? In that case, we have 1
choice about how we get to A, followed by 3 choices of where to come back
down after B is reached. Thus, this will account for 1 x 3 = 3 more paths.
What if we include a single upward move from C to D? In that case, we have
2 choices about how we get down to the bottom row prior to reaching C,
followed by 2 choices about how we get down to the bottom row after
reaching D. Thus, this will account for 2 x 2 = 4 paths.
What if we include a single upward move from E to F? We will have 3 choices
about how we get to the bottom row prior to reaching E, but only 1 choice
about how we get down to the bottom row after reaching F. This will account
for 1 x 3 = 3 paths.
What if we include two upward moves, one from A to B, the other from C to
D? In that case, we have just 1 choice about how we get to the bottom row
before the first upward move, just 1 choice about how we get to the bottom
row between the first and second upward moves, and 2 choices about how we
get to the bottom row once D has been reached. This will account for
1 x 1 x 2 = 2 paths.
What if we include two upward moves, one from A to B, the other from E to
F? In that case, we have just 1 choice about how we get to the bottom row
prior to the first upward move, 2 choices about how we get to the bottom row
between the first and second upward moves, and just 1 choice about how we
get back down once F is reached. This will account for 1 x 2 x 1 = 2 paths.
What if we include two upward moves, one from C to D, the other from E to
F? In that case, we have 2 choices about how we get to the bottom row prior
to the first upward move, just 1 choice about how we get to the bottom row
between the first and second upward moves, and just 1 choice about how we
get back down once F is reached. This accounts for 2 x 1 x 1 = 2 paths.
What if we include three upward moves, A to B, C to D, and E to F? In that
case, we have just 1 choice about how we get to the bottom row prior to the
first upward move, between the first and second upward moves, between the
second and third upward moves, and after the last of the upward moves. This
will account for 1 x 1 x 1 x 1 = 1 more possible path.
Thus, the total number of paths from “START” to G is equal to:
4 + (1x3) + (2x2) + (3x1) + (1x1x2) + (1x2x1) + (2x1x1) + (1x1x1)
=
4+
=
3
+
4
+
3
+
2
+
2
+
2
+
1
21
Note that the products in the previous computation include every possible
way that 4 can be written as a sum of natural numbers (including just the 4
itself), except that the addition signs have been replaced with multiplication
signs.
You probably noticed that the number of paths to the given letters form the
well-known Fibonacci sequence (1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, …).
In this sequence, the first two terms are 1’s. All subsequent terms in the
sequence are found by adding the two preceding terms. For example, the
ninth term is found by adding the seventh and eighth terms.
If we want to know how many paths there are from “START” to I, we can
determine the appropriate term in the Fibonacci sequence. There are 21
paths to G, 34 paths to H, and 55 paths to I. An alternate approach would be
to take the number 5, create all of its various partitions, multiply instead of
adding, and then sum the products, as shown here:
5 + (1x4) + (2x3) + (3x2) + (4x1) + (1x1x3) + (1x3x1) + (3x1x1) + (1x2x2) + (2x1x2)
+ (2x2x1) + (1x1x1x2) + (1x1x2x1) + (1x2x1x1) + (2x1x1x1) + (1x1x1x1) = 55
Note that the partitioning process (partition, change additions to
multiplications, add the products) performed on the number 4 gives us the
number of paths to the fourth letter on the bottom row, as well as the 8th
number in the Fibonacci sequence. Similarly, performing the partitioning
process on the number 5 gives us the numbe of paths to the fifth letter on
the bottom row, as well as the 10th number in the Fibonacci sequence. In
general, performing the partitioning process on the number N gives us the
numbe of paths to the Nth letter on the bottom row, as well as the (2N)th
number in the Fibonacci sequence.
Rather than performing the partitioning process when N = 10, we can instead
determine the 20th number in the Fibonacci sequence, which is 6765. This
also tells us that there would be 6765 paths from “START” to S (which would
be the tenth letter on the bottom row).