Substitute each of the capital letters in bold by a different base ten digit from 0 to 9 to satisfy this alphametic equation. Neither P nor O can be zero.
PANE = [OUTSHOUT/ PIANO], where the remainder obtained upon dividing OUTSHOUT by PIANO is less than 500.
Note: [x] denotes the greatest integer ≤ x.
(In reply to
re: Missed Solution? by Charlie)
&^#$@!!!!
Thanks again Charlie.
I missed building that comparison into my sheet!!
I even went to the point of rewriting Daniel's program (with a few adjustments) so as to use your "used(x)" construction which naturally found only one solution.
That listing appears below:
OPEN "piano2.txt" FOR OUTPUT AS #1
CLS 0
FOR p = 1 TO 9
IF used(p) = 0 THEN
used(p) = 1
FOR o = 1 TO 9
IF used(o) = 0 THEN
used(o) = 1
FOR n = 0 TO 9
IF used(n) = 0 THEN
used(n) = 1
FOR e = 0 TO 9
IF used(e) = 0 THEN
used(e) = 1
FOR h = 0 TO 9
IF used(h) = 0 THEN
used(h) = 1
FOR u = 0 TO 9
IF used(u) = 0 THEN
used(u) = 1
FOR t = 0 TO 9
IF used(t) = 0 THEN
used(t) = 1
FOR s = 0 TO 9
IF used(s) = 0 THEN
used(s) = 1
FOR a = 0 TO 9
IF used(a) = 0 THEN
used(a) = 1
FOR i = 0 TO 9
IF used(i) = 0 THEN
used(i) = 1
v1 = 1000 * p + 100 * a + 10 * n + e
v2 = (10 ^ 7) * o + (10 ^ 6) * u + (10 ^ 5) * t + (10 ^ 4) * s + (10 ^ 3) * h + (10 ^ 2) * o + 10 * u + t
v3 = o + 10 * n + 100 * a + 1000 * i + 10000 * p
fl = INT(v2 / v3)
rm = v2 - fl * v3
IF fl = v1 AND rm <= 500 THEN
PRINT v1, v2, v3, rm
PRINT p; a; n; e; o; u; t; s; h; i
PRINT #1, p; a; n; e; o; u; t; s; h; i
PRINT #1, v1; v2, v3, rm
END IF
used(i) = 0
END IF
NEXT
used(a) = 0
END IF
NEXT
used(s) = 0
END IF
NEXT
used(t) = 0
END IF
NEXT
used(u) = 0
END IF
NEXT
used(h) = 0
END IF
NEXT
used(e) = 0
END IF
NEXT
used(n) = 0
END IF
NEXT
used(o) = 0
END IF
NEXT
used(p) = 0
END IF
NEXT
CLOSE 1
|
Posted by brianjn
on 2009-08-13 02:45:35 |