Substitute each of the capital letters by a different digit from 0 to 9 to satisfy this set of alphametic relationships. None of the numbers can contain any leading zero.
The arithmetic mean of NOD and FIFE is FERN, and:
The geometric mean of NOD and FIFE is FOND, and:
The harmonic mean of NOD and FIFE is FOOD.
Note: For an extra challenge, solve this puzzle without using a computer program.
Yes, I was surprised that Charlie did not give a computer listing.
I did arrive at the same results and this was my listing:
OPEN "c:\qb64\work\fife.txt" FOR OUTPUT AS #1
FOR n = 1 TO 9
IF used(n) = 0 THEN
used(n) = 1
FOR f = 1 TO 9
IF used(f) = 0 THEN
used(f) = 1
FOR o = 0 TO 9
IF used(o) = 0 THEN
used(o) = 1
FOR d = 0 TO 9
IF used(d) = 0 THEN
used(d) = 1
FOR i = 0 TO 9
IF used(i) = 0 THEN
used(i) = 1
FOR e = 0 TO 9
IF used(e) = 0 THEN
used(e) = 1
FOR r = 0 TO 9
IF used(r) = 0 THEN
used(r) = 1
nod = 100 * n + 10 * o + d
fife = f * 1000 + i * 100 + f * 10 + e
fern = f * 1000 + e * 100 + r * 10 + n
fond = 1000 * f + 100 * o + 10 * n + d
food = 1000 * f + 100 * o + 10 * o + d
am = (nod + fife) / 2
gm = (SQR(nod * fife))
hm = 2 * nod * fife / (nod + fife)
IF (am = fern) THEN
IF (gm = fond) THEN
IF (hm = food) THEN
PRINT nod; fife
PRINT fern; fond; food
PRINT #1, nod; fife
PRINT #1, fern; fond; food
END IF
END IF
END IF
used(r) = 0
END IF
NEXT
used(e) = 0
END IF
NEXT
used(i) = 0
END IF
NEXT
used(d) = 0
END IF
NEXT
used(o) = 0
END IF
NEXT
used(f) = 0
END IF
NEXT
used(n) = 0
END IF
NEXT
CLOSE 1

Posted by brianjn
on 20120627 03:52:11 