Define a simple addition mathagram in base $k$ as a triplet of strings of letters $\{s_1, s_2, s_3\}$, each letter representing a digit in base $k$, and each string thus representing an integer $\{n_1, n_2, n_3\}$, expressed in base $k$, such that there is some assignment of digits to letters making this a valid addition. For example, $$ SEND + MORE = MONEY $$ in base ten has at least the solution $9567+1085 = 10652$, that is, $ S\to 9, E\to 5 \cdots Y\to 2$.
For the purposes of this question, we will use the term "mathagram" to mean a simple addition mathagram.
We impose two additional conditions to call such a triplet a mathagram:
- No two non-identical letters may map to the same digit.
- The starting letter of each string must map to a digit other than zero.
When posing mathagram problems it is traditional to use letters that form words for each string, but for this question that is not required or even a consideration.
Define the degree of a of a mathagram to be the maximal number of appearances of any letter in either of the addends. Thus the mathagram $$ USE + LESS = SONNY $$ is of degree $2$ because of the two $S$ letters in the second addend. (The letter multiplicities in the third string is moot for deciding the degree of the mathagram.)
Two mathagrams $\{s_1, s_2, s_3\}$ and $\{t_1, t_2, t_3\}$ are considered to be equivalent if
- $\{t_1, t_2, t_3\}$ is $\{s_2, s_1, s_3\}$, that is, they are the same triplets except the two addends are swapped (thus $MORE + SEND = MONEY$ is equivalent to $SEND + MORE = MONEY$); or
- there is a one to one mapping of the letters appearing in $\{t_1, t_2, t_3\}$ to the letters appearing in $\{s_1, s_2, s_3\}$ such that when this map is applied to $\{t_1, t_2, t_3\}$ the result is $\{s_1, s_2, s_3\}$ (thus $ABCD + EFGB = EFCBH$ is equivalent to $SEND + MORE = MONEY$); or
- they are both equivalent to some third mathagram (thus $EFGB + ABCD = EFCBH$ is equivalent to $SEND + MORE = MONEY$).
This question asks about counting non-equivalent mathagrams; the purist might re-word the question as asking for the number of equivalence classes.
Finally, a mathagram is strong if and only if the "solution" (the mapping of letters to numbers, forming a correct addition statement) is unique. For example, $ USE + LESS = SONNY $ is weak (is not strong) because it has two solutions: $$814 +9411 = 10225 \\ 715 + 9511 = 10226 $$ On the other hand, $SEND+MORE=MONEY$ is strong, since its solution is unique.
This question concerns how many strong mathagrams exist in a given base $k$. Since you can always form an infinite sequence of mathagrams from any mathegram just by repeating the strings, padding with zero's where necessary, for example, $$SENDOSEND + MOREOMORE = MONEYMONEY$$ we restrict our attention to mathagrams of degree $1$. Thus my principle question is:
How many non-equivalent strong degree-$1$ mathagrams exist in base $10$?
In base $2$, there are only $3$ strong mathagrams (and no weak ones) of degree $1$: $$A+A=AB \\ AB + A = AA \\ AB + AB = ABB $$.
In base $3$ there appear to be $40$ strong mathagrams (and about 8 weak ones) of degree $1$. Here, one must be careful not to over-count. For instance, these two mathagrams are equivalent, by swapping addends and then doing a syclic letter replacement: $$ ABC + BCA = BCBA \\ ABC + CAB = ABAC $$
I will give at least "like" credit for answers for any base higher than $3$.
I have computed both the total number and the number of uniquely solvable problems for bases $2$ through $9$. (Sorry, at present I can't compute the answer for base $10$ in a reasonable amount of time.)
I have submitted these sequences to the OEIS (where I am planning to make the code available):
https://oeis.org/draft/A277496
https://oeis.org/draft/A277497
$$\begin{array}{ccc} \text{Base} & \text{# solvable} & \text{# uniquely solvable} \\ 2 & 3 & 3 \\ 3 & 49 & 43 \\ 4 & 1020 & 909 \\ 5 & 28666 & 25264 \\ 6 & 1099824 & 946088 \\ 7 & 57520786 & 49916876 \\ 8 & 3882860433 & 3402999604 \\ 9 & 331811494082 & 295506405205 \\ \end{array}$$