# Lawbreaking by the numbers

Special Agent Benford has been stymied by a third unsolved case of miscreant creative accounting and will voluntarily retire from the Fraudulent Numbers Task Force. Benford’s ability to detect falsified ledgers by merely counting the first digits of numerical entries is so renown that a law bears the name of our crestfallen hero.

Benford’s Law:  On an honest accounting sheet, the first digit of almost 1⁄3 of all numerical entries should be ‘1’, much more often than ‘2’ or any other numeral. The count of each numeral’s being a first digit fits a decreasing pattern where ‘9’ is the first digit of the fewest numbers.

This methodology served Benford well through decades of service as unscrupulous accountants mostly juggled decimal numbers. Over the years, however, two cases remained uncracked because they involved other numbering systems. All positive whole numbers are suspect.

1. Unsolved Case One. Recognizing the oldest known numbering system, Benford knew that its first digits would not lead to conviction.

2. Unsolved Case Two. Benford recognized this numbering system as one employed by virtually all modern computers and again had to admit that its first digits were free of clues.

At last, alas, came the latest case.

1. Unsolved Case Three. Benford had never before encountered this numbering system but upon seeing the entries realized that they too would defy “The Law.” Before giving up, Benford did learn that the same deviant numbering system had been seen among scholarly circles for centuries, though rarely, and has actually been the basis of some cleverly efficient digital computers.

What are the numbering systems of Cases One, Two and Three and why are they so Lawless?

Bounty challenge: In which of these cases can Benford’s replacement, Special Agent Successor, be more successful by counting entries’ second digits? What would be their expected numeral frequencies?

(No foul wordplay is afoot.)

I think the answer is as follows.

Case One:

Unary, also known as tally arithmetic. Each number is given by a number of symbols (typically vertical slash marks similar to the numeral one), hence the first "digit" is always the same. This is, of course, the oldest method of counting.

Case Two:

Binary. Again, the first digit of every number is 1, thus Benford's law cannot be of help. Binary is the basis for most modern computer architectures.

Case Three:

Balanced ternary. In balanced ternary, the digits are 1, 0 and -1, and the first digit of every positive number is always 1. There are several theoretical reasons why balanced ternary makes certain mathematical operations more efficient, and was apparently used as the basis for some Soviet computers in the past.

Bonus:

Looking at the second digit will provide some statistical bias in the binary and balanced ternary cases, but not in the unary case. For the binary case, using a straightforward generalization of the distribution provided at Wikipedia, the probability the second digit is 0 is $$\log_2(3) -\log_2(2)$$, which is about 58.5%.

For balanced ternary, the distribution of the second digit seems like it should be similar to ternary, but is subtly different. To accomplish this, we're going to relate the balanced ternary distribution to the regular ternary distribution. In the regular ternary distribution, the probability that a number starts with $$n$$ (as a string of digits) is $$\log_3(n+1) - \log_3(n)$$.

For ease of presentation, we can ignore the numbers with less than 3 balanced ternary digits, since there will be a finite number of exceptions to the rules we posit below which vanish as we look across the infinitude of integers. Also, we will use the symbols $$+$$, $$\cdot$$ and $$-$$ for our balanced ternary digits.

Let's look first at the case where the second digit is $$-$$. Converting to ternary, we have $$[+ - - , + - +] \equiv [12,21]$$, $$[+ - - -, + - + +] \equiv [112,211]$$, $$[+ - - - -, + - + + +] \equiv [1112,2111]$$, and so on. Thus, the second digit of a balanced ternary number is $$-$$ if and only if the corresponding ternary number starts with $$12$$, $$112$$, $$1112$$, $$\ldots$$; $$20$$; or $$21$$, with the exception of those starting with $$212$$, $$2112$$, $$21112$$, $$\ldots$$. To get the probability of this occurring, we add up all of the associated probabilities from the Benford distribution on the normal ternary ranges. Using the Magma Calculator, we obtain the approximate probability 46.5%.

Now consider the case where the second digit is $$\cdot$$. As above, for balanced ternary numbers meeting this condition, the equivalent ternary numbers satisfy $$[ + \cdot - , + \cdot + ] \equiv [22 , 101]$$ , $$[ + \cdot - -, + \cdot + +] \equiv [212 , 1011]$$, $$[ + \cdot - - -, + \cdot + + +] \equiv [2112 , 10111]$$, etc. So as before, a balanced ternary number has second digit $$\cdot$$ when the corresponding ternary number begins with $$212$$, $$2112$$, $$21112$$, $$\ldots$$; $$22$$; or $$10$$, with the exception of those that start with $$102$$, $$1012$$, $$10112$$, $$\ldots$$. This yields a probability of about 30.63%.

For second digit $$+$$, we could just add the previous results and subtract from 1, but as a check let's calculate it the same way. As above, we have $$[ + + - , + + + ] \equiv [102 , 111]$$ , $$[ + + - -, + + + +] \equiv [1012 , 1111]$$, $$[ + + - - -, + + + + +] \equiv [10112 , 11111]$$. Thus the second balanced ternary digit is $$+$$ when the corresponding ternary number starts with $$102$$, $$1012$$, $$10112$$, $$\ldots$$; or $$11$$, except those starting with $$112$$, $$1112$$, $$11112$$, $$\ldots$$. As above, this probability sums to 22.87%.

For comparison's sake, the probabilities for second digits in normal ternary are 40.22%, 32.47%, and 27.32% for $$0$$, $$1$$ and $$2$$, respectively.

• @humn: I do feel like there is a better measure theory answer to this question, but I hated measure theory when I took it 30 years ago (OMG, how did I get so old?). Aug 31 '20 at 15:28
• Measure-theory szhmeasure-theory, Jeremy Dover, thank you for a much better solution than hoped for: well-written and complete in itself with references to boot. And solved so quickly upon the puzzle's posing! Thank you also for introducing Magma to those of us who have gone without. (I did come up with the same Case Two numbers in a lucky way that began with a presumed logarithmic distribution and ended with a surprising alignment of the arithmetic subsequence 1-3-5-7-9 and the exponential subsequence 1-3-9. For instance, your first number is $\log_3 {5 \over 3} = .46497\dots\,$.)
– humn
Aug 31 '20 at 17:04
• @humn: Thanks for the bounty! Not necessary, but much appreciated :-) Sep 5 '20 at 12:40
• @humn I had used the answer to Case 3 in a puzzle not terribly long ago, so I was well aware that it shared the first-digit pattern with the first two cases. I think this is just one of those cases where different puzzlers have different tools in their toolkits :-) Sep 5 '20 at 20:58
• Classically it is used in coin weighing problems, such as this one. My puzzle that used it is here. I used it versus the unbalanced version for a little extra misdirection, but also to increase the significance of all three indicators. Sep 5 '20 at 21:19