All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 A permuted multiplication (Posted on 2014-03-11)
In the multiplication given below, all the digits, except one, were consistently replaced by another digit:

```    617
*   702
_______
1639
3733
2807
__________
265699
```

Find the substitution code and restore the original multiplication.

 No Solution Yet Submitted by Ady TZIDON No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 solution | Comment 3 of 9 |

DECLARE SUB permute (a\$)
CLS
a\$ = "1234567890": h\$ = a\$

DO
IF MID\$(a\$, 6, 1) <> "0" AND MID\$(a\$, 7, 1) <> "0" AND MID\$(a\$, 1, 1) <> "0" AND MID\$(a\$, 3, 1) <> "0" AND MID\$(a\$, 2, 1) <> "0" THEN
mct = 0
FOR i = 1 TO 9
IF MID\$(a\$, i, 1) = LTRIM\$(STR\$(i)) THEN mct = mct + 1
NEXT
IF MID\$(a\$, 10, 1) = "0" THEN mct = mct + 1
IF mct = 1 OR mct = 2 THEN
mpr1 = VAL(MID\$(a\$, 6, 1) + MID\$(a\$, 1, 1) + MID\$(a\$, 7, 1))
mpr2 = VAL(MID\$(a\$, 7, 1) + MID\$(a\$, 10, 1) + MID\$(a\$, 2, 1))
prod = mpr1 * mpr2
pr = VAL(MID\$(a\$, 2, 1) + MID\$(a\$, 6, 1) + MID\$(a\$, 5, 1) + MID\$(a\$, 6, 1) + MID\$(a\$, 9, 1) + MID\$(a\$, 9, 1))
IF prod = pr THEN
PRINT mpr1: PRINT mpr2
PRINT MID\$(a\$, 1, 1) + MID\$(a\$, 6, 1) + MID\$(a\$, 3, 1) + MID\$(a\$, 9, 1)
PRINT MID\$(a\$, 3, 1) + MID\$(a\$, 7, 1) + MID\$(a\$, 3, 1) + MID\$(a\$, 3, 1)
PRINT MID\$(a\$, 2, 1) + MID\$(a\$, 8, 1) + MID\$(a\$, 10, 1) + MID\$(a\$, 7, 1)
PRINT prod: PRINT
END IF
END IF
END IF
permute a\$
LOOP UNTIL a\$ = h\$

finds these two multiplications (formatted manually):

`    516    693-------       1548  4644 3096------- 357588`
`    754    493-------       5762  6466 3894-------  371722 `

where the partial products are done from the code deduced by the multipliers and the products.

But manually checking the partial products' values shows that only the first claimed solution is real:

`    516    693-------       1548  4644 3096------- 357588`

 Posted by Charlie on 2014-03-11 14:30:36

 Search: Search body:
Forums (0)