Back when I wrote about cryptarithms, I mentioned that they are part of the “low hanging fruit” in terms of the easier CONs (cipher constructions) included in the ACA Cryptogram (Cm) newsletter. The Cm comes out every 2 months, and contains 100-106 CONs per issue. Roughly 25 CONs are Aristocrats (newspaper-style crypto-quips), 15-20 are Patristocrats (Aristocrats without the word spacing or punctuation), 15 are cryptarithms (math puzzles where letters substitute for the numbers), 20-25 are regular ciphers (rail fence, Fractionated Morse, Vigenere, etc.), 10 are xenocrypts (regular cipher types in other languages), and a few are harder cipher types that may break the rules some how. If you want to maximize the number of CONs you solve per issue, then you’ll want to focus on Aristocrats, the easier Patristocrats, and the cryptarithms. The main reason for this opinion is that these are the CONs that all follow a specific algorithm for each type, there are a bunch of them for each type, and they’re generally relatively easy. Conversely, xenos, regular ciphers and exceptions tend to be one of any given cipher type, so if you’re going to tackle the regular cipher section, that’s 20-25 DIFFERENT algorithms you have to master (the ACA recognizes 60 algorithms total) at a time. My current goal is to learn one or two new cipher algorithms every two months. Writing solvers for all 60 types is going to take a few years.

I also mentioned in an earlier article that I’d written a parser to automatically convert the digital version of the cryptarithm CONs from the ACA downloads page into the format I use with a solver I’d written in VBScript. At the time, both scripts only handled CONs in base 10. And I was happy with that, at the time. The thing is, the Cm cryptarithm CONs can be in base 5, 8, unidecimal (base 11), duodecimal (base 12), or whatever the author wants to use. They can also be double key (using two sets of letters, one set upper case, and the other lower case). I figured that I could tackle adding new bases to the solver later on when I got bored. But, as I was solving the new CONs in the Nov.-Dec. 2018 issue, I caught a bug in the parser where it choked on parsing cube root equations. I could bypass the parser and just hand-type the statements in the format the solver needed them in, but as I was doing that, I started looking at the base 5 double-key CON, and thought “I could even do this myself, with pencil and paper.”

Well, I had a pencil and some paper, plus about an hour between teaching classes, so I sat down and began working on that CON. And when I began getting really frustrated, I focused on what I’d need to do to modify my existing solver to include other bases. Eventually, I worked on modding the solver instead of hand-solving the CON. It seemed better to leave my existing solver alone, because it already runs fast on decimal CONs and I didn’t want to sacrifice that. I’m good with having a second solver specifically for non-base-10 CONs (single key), and it really didn’t take all that long to make the changes. The two key functions are “makeDeci()”, which converts a numeric string to decimal; and, “makeBase()”, which converts a decimal numeric to a string representation of the desired base. They both work on a per-digit basis. For makeBase(), if the digit is 0-9, I just convert it with cstr(). Otherwise, I use chr(65 + value) to get “A” through whatever the base system uses (for duodecimal, “A”-“B”), After implementing these two functions, I just went through the rest of the script and replaced any instances of “cstr()” and “int()” with the appropriate base converter. Including debugging, it took me maybe 1 hour to finish the script.

Base 5 and Base 10 CONs take very little time to solve on average, usually between 1 and 15 minutes. Things get much less good at base 12, although I did get lucky on the first try. The Nov.-Dec. 2018 Cm issue has two duodecimal CONs, the first being for addition and subtraction, the second for division. I used the first CON to test drive the new solver, and it crashed on finding the solution within 15 minutes. Turns out I’d missed putting in a call to makeBase() in the section that prints out the solution. I made that fix, changed the starting key string to the solution value, and the solution printed out correctly. After a bit more testing, I plugged in the division CON, and that took the better part of 8 hours to solve (the key was something like 31A24506B897, meaning to get to that from 0123456789AB required a LOT of time). So, yeah, the larger the base, the MUCH longer it takes to test every permutation of the key. Go ahead, ask me what happened when I tried to solve a base 15 square root…

After all that above, I returned to the base 5 double key CON. This is an ACA puzzle. If you would like to see more of them, become a member.

bASE + fiVE = ViEAS

bASE – fiVE = ibok

R * b = fE

If you’re not familiar with these kinds of puzzles/brain teasers, the first step is to identify 0, 1 and 5 (for base 10 CONs). For this specific CON, the digits 0-4 appear twice (once each for the upper case letters, and once each for lower case). If we sort the two cases, we get:

bfiok ASEVR

You can easily see that with “E – E”, k = 0.

The next step is to look at what happens with base 5 addition and multiplication.

1 + 1 = 2

1 + 2 = 2 + 1 = 3

1 + 3 = 3 + 1 = 4

1 + 4 = 4 + 1 = 10

2 + 2 = 4

2 + 3 = 3 + 2 = 10

2 + 4 = 4 + 2 = 11

3 + 4 = 4 + 3 = 12

4 + 4 = 13

1 * n = n

2 * 2 = 4

2 * 3 = 11

2 * 4 = 13

3 * 3 = 14

3 * 4 = 22

4 * 4 = 31

We won’t have to worry about leading 0s.

Notice that because 5 is prime anyway, no 2 numbers multiplied together (unless one of them is 0) will produce a 0 in the 1’s place.

With this information, we can say that no matter what b and f are, adding them together, even with a carry bit, can’t be bigger than 14. So, b + f = 1?. That is, V = 1

With R * b = fE, neither R nor b can be 0 or 1, because the result has to be 2 digits long. Also, R and b can’t both be 2 (=4).

With bASE + fiVE = ViEAS, E + E = 2*E, and S will be 1, 3 or 4. However, V is 1, so S can only be 3 or 4. (E can’t be 0 because E+E and E-E give different results, and R*b = fE can’t produce a 0 in the 1’s place.) But, if S is 3 or 4, 2*E = S means that E can only be 2 or 4. Right now, for the upper case letters, that gives us:

A = 0, 2, 3, 4

R = 2, 3, 4

E = 2, 4

S = 3, 4

V = 1

The only uppercase letter that can be 0 is A.

A = 0

R = 2, 3, 4

E = 2, 4

S = 3, 4

V = 1

Going back to R * b = fE, E can only be 2 or 4, and R can only be 2-4. And b must be bigger than f and i (bASE – fiVE = ibok; for example, if i=1, and f=2, b must be 3 or 4.) 2 * 3 = 11, 2 * 4 = 13, 3 * 3 = 14, 3 * 4 = 22 and 4 * 4 = 31. E = 2 or 4 rules out everything but 3 * 3 and 3 * 4. But, if R is 3 and b is 3, E must equal 4, leaving S = 2, and from the above table we can see that 2 is not an option for S. Therefore, either R = 3 and b = 4; or, R = 4 and b = 3. Either way, 3 * 4 = 22 = fE.

A = 0

V = 1

E = 2

R = 3, 4

S = 3, 4

And, bASE + fiVE = ViEAS implies S = 2*E = 4, therefore R = 3

A = 0

V = 1

E = 2

R = 3

S = 4

Looking at bASE – fiVE = ibok, we can’t have negative numbers, and since each lower case letter uniquely represents one and only one number, b must be larger than f and i, which means b is either 3 or 4. But now we know that k = 0, E = 2, S = 4 and V = 1. That gives 42 – 12 = (o)0, so that o = 3. By extension, b = 4.

=============================

I need to cut my blog entry short here, because the deadline for submitting the solutions for the Nov.-Dec. 2018 issue isn’t until the end of Feb. I’ll update this article in March, if I need to.

=============================

—

Finally, as I mentioned above, there was one base-15 square root CON in the Nov.-Dec. 2018 issue of the Cm newsletter, and that anything over base-12 would take days to solve through brute force with a VBScript. In fact, I let my solver run a full day on the base-15 CON, and it had only gotten from 0123456789ABCDE to 012E3456789ABCD. At this rate, I might not get a solution for months.

The funny thing is that for logic puzzles, there are often multiple ways to approach the problem. While the “normal” approach is to apply logic and the process of elimination as with the base-5 double key above, I prefer applying pure brute force and trying every permutation of digits until I get the correct numerical results (because I’m lazy and because this approach works for smaller bases). But, there is one more method left over.

[The following two paragraphs have been redacted because the deadline for submitting the solutions for the ND2018 Cm isn’t until the end of February. If enough people ask for it, I’ll come back to this blog entry and put the solutions back in after the deadline passes.]

And, that’s to anagram the letters of the puzzle. Granted, the letters are already partially anagrammed (bASE fiVE), but the key to the digit order (0-9, 1-0, 9-0 or 0-1) will produce a different word or combination of words. For the base-5 double key, it’s ********** (0-4, 0-4, upper case then lower case). For the base-15 square root CON, the letters in the puzzle are “***************” (I’m not going to reprint the full CON here). Running the letters through an online anagram solver gives “***************”, along with a whole bunch of other words. I’m inclined to write another script to take these words and run them against the full letter list to see what other letters aren’t covered by the anagram. For the Nov.-Dec. 2018 CON, the hint was that the key formed two words. So, whatever letters aren’t in the first anagram must form a second word.

Knowing the sense of humor of the ACA people, I was immediately attracted to “***********”, and the missing 4 letters were “****”. From that I got “****”, which is a legal word. The question remaining was, “is the key ‘***************’ or ‘***************’?” Because the number order for the CON was E-0, I first assigned EDCBA9876543210 to choice 1 and plugged that into my brute force solver. That failed, so I tried EDCBA9876543210 = choice 2, and the solution popped right out. If that had also failed, I would have needed to go to the 9-letter anagrams, and try those one at a time. Something of a pain, but I’d still get my solution within a day or two, instead of after a couple months.

Anyway, by going back to the cryptarithms and tackling non-base-10 CONs, I was able to get 4 more solves within just a few days. That’s a much better return on my time than if I tried mastering 4 all-different cipher types for the regular cipher exchange section of the newsletter. As of this writing, I’ve solved 51 of the 106 CONs, and I have solvers for 4-5 more CONs that I haven’t gotten to checking yet. If I can solve 50 CONs per issue, I’m happy.