« Boston Python puzzles

# Extreme Verbal Arithmetic

Every puzzle-lover has toyed with verbal arithmetic:

SEND + MORE = MONEY

This verbal equation is arithmetically satisfied by these substitutions:

{'O':0, 'M':1, 'Y':2, 'E':5, 'N':6, 'D':7, 'R':8, 'S':9}

which results in this numeric equation:

9567 + 1085 = 10652

But that's too easy. So let's play extreme verbal arithmetic.

Rather than just representing digits, the letters can also represent the arithmetic operators +, -, *, and /.

The goal is to find the extreme solution, the one that equates to the
largest value. For example:

HI = FLY

There are many solutions:

13 = 9+4
15 = 8+7
16 = 8*2
21 = 7*3

But what is the extreme solution?

The largest possible value for HI is 98. But there is no FLY expression that
evaluates to 98. (Prove it to yourself.) So how about 97? 96? 95? Nope, FLY
has too few letters for their factors. Oh! How about 81 = 9*9? Sorry, FLY
can't be 9*9 since F and Y are not allowed to both be 9. Nothing works
until you get to the extreme solution of 72:

72 = 9*8

NOTE that the characters ** are the exponential operator. For example:

MOON = MEAT
3**4 = 3+78 = 81

Note also that in Python 2, numbers starting with a zero digit are base-8: 0123 == 83.
In Python 3, numbers starting with zero are syntax errors!
(what do numbers starting with 0 mean in Python?)
And don't forget that both / and // are division operators.

You may find the solutions to this puzzle helpful.

Find the extreme solution for the following equations.

1. TON = NOT

2. SNAP = PEA

3. EMAIL = SPAM

4. MASSACHUSETTS = MA

5. NOON = TUTORIAL

6. WOMAN = MAN = NOW

7. ABBABBA = A

8. PYTHONIC = HYPNOTIC

9. CAMBRIDGE = CODERS

10. BANISTER = PAINTER = ANGER

BONUS: What verbal arithmetic equation has the most extreme solution of
all? (English dictionary words only.)

And if you've gone this deep down the rabbit hole, you may be interested to
learn more about the speed
of calculations in Python and about truly big
numbers.

## Solutions

If you have a solution you'd like to share see the Solutions page for instructions.