=====Walkthrough===== Following will be a walkthrough (the documentation in a form acceptable for submission, provided as an example of both the form I'd like to see submissions in, but also providing illumination in the process of solving a letter division puzzle) of the following puzzle: YJP +--------- YZZZDP | ZNZVZOZO -ODDDQP ====== YMPQQOZ -YOJJZNP ======= QMYZO base: 10 letters: DJMNOPQVYZ The intent of the documentation (and therefore the project you are performing) is NOT merely to SOLVE the problem, but to document the step-by-step process of solving the problem. That is demonstrated here. ====Getting underway==== Some initial observations help us whittle down some possibilities (looking at left-most subtractions): * topmost left subtraction: O << Z * bottom left subtraction: Y-Y * the result is zero. We're not being taken from to help the next subtraction, so: * O << M, but since we see the result here ALSO resulting in zero, that means two things: * we ARE being taken from (P << J) * because M-O is ZERO, that means O is precisely one less than M (O < M). From these observations: * J cannot be zero (since it is greater than at least P) * P cannot be nine (since it is less than at least J) * O cannot be nine or eight (since it is less than both Z and M) * M cannot be zero or nine (since it is one greater than O, and some quantity less than Z) * for the same reasons, Z cannot be zero or one (since both O and M are less than it) Updating our chart: D = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } J = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } M = { 1, 2, 3, 4, 5, 6, 7, 8 } N = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } O = { 0, 1, 2, 3, 4, 5, 6, 7 } P = { 0, 1, 2, 3, 4, 5, 6, 7, 8 } Q = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } V = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } Y = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } Z = { 2, 3, 4, 5, 6, 7, 8, 9 } And identified ranges: P << J O < M << Z ====Finding zero (P) and nine (J) values==== Continuing on with our initial analysis, in the bottom left-oriented subtractions, where we determined M was one greater than O, due to the result being zero, indicating P << J so it needs to borrow; we see THAT result is ALSO zero. What is happening here? If P is less than J, P needs to borrow, so: P+10 - J ==== 0 Right? So how in the world can this be? J as a single letter can NOT be 10, and P+10 cannot be less than 10. However, in similar fashion to M being identified as one greater than O, do we not have the same pattern playing out here? P+10-J is being taken from as well! So, knowing that: P+10-1 - J ====== 0 The SMALLEST P+10-1 can be is now 9 (because the smallest it could ever be is 0; 0+10-1 is 9), and 9 minus WHAT is zero? 9 of course. So we have now identified P is zero, and J as nine. Let's update our chart: D = { 1, 2, 3, 4, 5, 6, 7, 8 } J = { 9 } M = { 2, 3, 4, 5, 6, 7 } N = { 1, 2, 3, 4, 5, 6, 7, 8 } O = { 1, 2, 3, 4, 5, 6 } P = { 0 } Q = { 1, 2, 3, 4, 5, 6, 7, 8 } V = { 1, 2, 3, 4, 5, 6, 7, 8 } Y = { 1, 2, 3, 4, 5, 6, 7, 8 } Z = { 3, 4, 5, 6, 7, 8 } And we can start populating the key: 0 P 1 2 3 4 5 6 7 8 9 J ====Further discovery==== Continuing along with our bottom subtraction chain (from the left), we are now onto Q-J=Q. We know the identity of J as nine, so how is this possible? Well, we know from the previous subtraction that Q is less than J (heck, we know EVERY letter is less than J, due to J being nine), so a borrowing has to take place. To prototype this, let's take the smallest possible value of Q (one), and set this up: Q+10 1+10 11 - J - 9 - 9 ==== --> ==== --> ==== Q 1 1 11-9 does NOT equal 1 (but instead 2), BUT: 10-9 DOES equal 1. ANOTHER "taking from"! Q << Z (for our range purposes, Q cannot be 8, and Z cannot be 3). Testing this for any possible value of Q reveals this to be the case: Q of 2: Q+10-1 2+10-1 11 - J - 9 - 9 ====== --> ====== --> === Q 2 2 Q of 3: Q+10-1 3+10-1 12 - J - 9 - 9 ====== --> ====== --> === Q 3 3 Q of 4: Q+10-1 4+10-1 13 - J - 9 - 9 ====== --> ====== --> === Q 4 4 Our current chart: D = { 1, 2, 3, 4, 5, 6, 7, 8 } J = { 9 } M = { 2, 3, 4, 5, 6, 7 } N = { 1, 2, 3, 4, 5, 6, 7, 8 } O = { 1, 2, 3, 4, 5, 6 } P = { 0 } Q = { 1, 2, 3, 4, 5, 6, 7 } V = { 1, 2, 3, 4, 5, 6, 7, 8 } Y = { 1, 2, 3, 4, 5, 6, 7, 8 } Z = { 4, 5, 6, 7, 8 } Our known ranges: O < M << Z Q << Z The next subtraction: Q+10-Z=M We don't yet know if this is being taken from, as we do not have enough information to make that determination (O-N=Y, we lack the requisite information in the current context, not knowing O's relationship to N or Y). What we can do is whittle M down a bit. For instance, we KNOW that Q << Z, and assuming a difference of one, these are the sorts of results we'd have: Q of 3 (smallest Z is currently 4): 13 <-- Q -4 <-- Z == 9 <-- M How about a difference of 2 between Q and Z? Q of 2: 12 <-- Q -4 <-- Z == 8 <-- M Q of 3: 13 <-- Q -5 <-- Z == 8 <-- M How about the maximal difference between Q and Z? Q of 1, Z of 8: 11 <-- Q -8 <-- Z == 3 <-- M From the smallest to the largest difference between Q and Z, we notice that M is ALWAYS greater than Q. So, to update our ranges, we can combine everything into one line: Q << O < M << Z or, to be fully accurate: P << Q << O < M << Z << J This allows some further whittling down in our chart, because now we know: * Q can NOT be 9, 8, 7, or 6 * O can no longer be 1, M can no longer be 2 D = { 1, 2, 3, 4, 5, 6, 7, 8 } J = { 9 } M = { 3, 4, 5, 6, 7 } N = { 1, 2, 3, 4, 5, 6, 7, 8 } O = { 2, 3, 4, 5, 6 } P = { 0 } Q = { 1, 2, 3, 4, 5 } V = { 1, 2, 3, 4, 5, 6, 7, 8 } Y = { 1, 2, 3, 4, 5, 6, 7, 8 } Z = { 4, 5, 6, 7, 8 } Our current exploration of the bottom subtraction has reached a stopping point, as until we discover better clarity as to the identity of N and Y (looking at our chart, along with D and V, have experienced zero whittlings aside from the known 0 and 9 values). We DO know that O is NOT being "taken from", as Z-P=Z (P is 0, every letter other than P is greater than zero). How about the top subtraction? Here we'll start on the right side, with another zero subtraction, letting us know that the second to last subtraction (Z-Q=Q), is NOT being "taken from". Furthermore, we know that Z is greater than Q (by a difference of at LEAST 3, if not more), and that clarification allows some other patterns to come into play: Z -Q == Q We KNOW there are: * no values taking from this subtraction. * no need to borrow So we can analyze this equation as-is. Of note, we are subtracting Q to get a result of Q. Or, put another way: * Q + Q = Z Q can currently be any of 1, 2, 3, 4, or 5, and Z can currently be any of 4, 5, 6, 7, or 8. Due to known ranges, Q is less than Z. So, plugging those into sample equations, we get: * Q of 1: 1 + 1 = 2 (invalid, Z cannot be less than 4) * Q of 2: 2 + 2 = 4 (possible, valid values for Q and Z) * Q of 3: 3 + 3 = 6 (possible, valid values for Q and Z) * Q of 4: 4 + 4 = 8 (possible, valid values for Q and Z) * Q of 5: 5 + 5 = 10 (invalid, no letter can be greater than 9). Since we're adding Q against Q, we KNOW that the result MUST be an even number, so Z is therefore even (eliminating 5 and 7), leaving just 4, 6, or 8. We have also eliminated the values of 1 and 5 for Q. And since Q is less than O and M, their minimum values also get bumped up by one (because if Q cannot be 1, its smallest value is 2, and O is GREATER than Q, so O can no longer be 2 as a result). Updated chart: D = { 1, 2, 3, 4, 5, 6, 7, 8 } J = { 9 } M = { 4, 5, 6, 7 } N = { 1, 2, 3, 4, 5, 6, 7, 8 } O = { 3, 4, 5, 6 } P = { 0 } Q = { 2, 3, 4 } V = { 1, 2, 3, 4, 5, 6, 7, 8 } Y = { 1, 2, 3, 4, 5, 6, 7, 8 } Z = { 4 6 8 } Looking at the next top-level subtraction, we seem to currently be limited in our possibilities: * not having a good handle on D or V, we cannot make any clear assumptions for V-D=Q. For Z-D=P, we know that P is 0, so can this tell us anything? * we know Z is 4, 6, or 8 * we don't what what D is; it could be larger or smaller. * we DO KNOW that we're being taken from (ah: V << D, so V cannot be 8, and D cannot be 1), as how else would LETTER-OTHERLETTER=ZERO ? ... can we add any further clarification? Assuming Z is greater than D: * D would not be able to be 8 or 9. * D would have to be 3, 5, or 7 for that subtraction to work. * D is ONE LESS THAN Z (D < Z). Now, assuming Z is less than D: * Z would not be 8 (so only 4 or 6, or 14 and 16, remain). * D would not be 1, 2, 3, or 4 * 14-1=13, 16-1=15. No single letter can be greater than nine, and since those are the only two possibilities, we can now claim that Z is greater than D: D << Z Applying these new discoveries, we can further say that V (being less than D) cannot be 8 or 7, to correspond with our known values of D. So, updating our chart: D = { 3 5 7 } J = { 9 } M = { 4, 5, 6, 7 } N = { 1, 2, 3, 4, 5, 6, 7, 8 } O = { 3, 4, 5, 6 } P = { 0 } Q = { 2, 3, 4 } V = { 1, 2, 3, 4, 5, 6 } Y = { 1, 2, 3, 4, 5, 6, 7, 8 } Z = { 4 6 8 } Known ranges: P << Q << O < M << D < Z << J P << V << D < Z << J Hey, some further optimizations to Z and other letters are now possible: * there are now 6 values (0-5) less than Z, so Z can NOT be anything less than 6. 4 can be eliminated. * because we have Q and Z linked (Q+Q=Z), Q can NOT be 2, due to having eliminated Z as 4. * M cannot be 7, O cannot be 6. * D cannot be 3. * due to the elimination of 2 for Q, the lower bounds of O and M are once again bumped up by one. The updated chart: D = { 5 7 } J = { 9 } M = { 5, 6 } N = { 1, 2, 3, 4, 5, 6, 7, 8 } O = { 4, 5 } P = { 0 } Q = { 3, 4 } V = { 1, 2, 3, 4, 5, 6 } Y = { 1, 2, 3, 4, 5, 6, 7, 8 } Z = { 6 8 } ====Determining D, Z, Q, O, and M==== And that creates FURTHER reductions: * since M is less than D, and the SMALLEST value for M is 5, D can NOT be 5, otherwise M could not be placed. So D cannot be 5. This means D is 7. * solving for D, we know Z is one greater, so Z is 8. * solving for Z, we now know Q is 4. * Since Q is 4, nothing else can be 4, which means O is 5. * M, being one greator than O, is now known to be 6. A nice cascade effect due to our known ranges. Our further updated chart: D = { 7 } J = { 9 } M = { 6 } N = { 1, 2, 3 } O = { 5 } P = { 0 } Q = { 4 } V = { 1, 2, 3 } Y = { 1, 2, 3 } Z = { 8 } Updated key: 0 P 1 2 3 4 Q 5 O 6 M 7 D 8 Z 9 J ====Finding V==== We are now left with just 3 uncertainties: the identities of N, V, and Y. A prior subtraction can now be solved, that of: V-D=Q We know: * V is less than D, so it needs to borrow (+10) * we are NOT being taken from (because to the right, Z is greater than Q) * the value of D is 7. * the value of Q is 4. Altering it to an addition (Q+D=V+10), we know: * Q(4) + D(7) = 11 * 11 - 10 = 1 * V = 1 Updated chart: D = { 7 } J = { 9 } M = { 6 } N = { 2, 3 } O = { 5 } P = { 0 } Q = { 4 } V = { 1 } Y = { 2, 3 } Z = { 8 } Updated key: 0 P 1 V 2 3 4 Q 5 O 6 M 7 D 8 Z 9 J ====Finding N and Y==== We're now down to our two final letters. In a way, we only need to find which is greater (N or Y) to yield our result, if we do not otherwise identify one of the values. There are two spots where N occurs in a subtraction, and (in practical context, not counting Y-Y=0), Y occurs once. Let us look at the top-left subtraction (where we started): Z-O=Y We know that: * Z is greater than O (O << Z). Z is 8. * Z is greater than Y (Y << Z). O is 5. We now know (from knowing the value of D), that N << D (2 or 3 is less than 7), so we are being TAKEN FROM HERE: Z-1 - O = Y We can just plug in values and solve: Z-1 8-1 7 - O - 5 - 5 === --> === --> === Y Y 2 Therefore, Y is 2. As a result of elimination, the only value N can be is 3. Updated chart: D = { 7 } J = { 9 } M = { 6 } N = { 3 } O = { 5 } P = { 0 } Q = { 4 } V = { 1 } Y = { 2 } Z = { 8 } Updated key: 0 P 1 V 2 Y 3 N 4 Q 5 O 6 M 7 D 8 Z 9 J And we have solved the puzzle!