Numerological Transform

I was reading Les jeux et les hommes (the original of Man, Play and Games, [wikipedia] [Amazon.com] and Caillois (the author) makes a remark about numerology. First, he discredits it as merely superstitious (on which I agree totally), but he then makes the remark that the “numerological transform”, this operation that consists in adding the digits of a number repeatedly until only one digit is obtained is uniform over all numbers. Does that makes intuitively sense? Well, we can at least verify it experimentally first!

psychedelic-flowers-small

First, let’s write a short program to generate the raw data. This time, I’ll use Mathematica because it’ll be easier to plot the results. The procedure is as follows:

numerologic[n_, m_] := Module[
  {x = IntegerDigits[n, m], s},
  s = Sum[x[[i]], {i, Length[x]}];
  If[s >= m,
   Return[numerologic[s, m]],
   Return[s]
   ]
  ]
Default[numerologic, 2, 10]

So basically, we extract the base m digits, sum them, and if the sum is greater than, or equal to, m, we reapply the algorithm to the sum. Eventually, we reach a sum that is between 1 and m inclusive.

We can now gather end values for m from, say, 2 to 20, on numbers from 1 to a few millions. What we find is that the all the histograms are thoroughly uninteresting: they’re uniform. All of them, very. For a given m, all m histogram bins have the same count (except minor rounding when n, the number of numbers we have tested is not a multiple of m). But Why?

Histogram for base 13, with 13^5 samples

Histogram for base 13, with 13^5 samples

Well, let’s have a look at how the “numerological” transform works, starting with the largest base 10, 2 digit number, 99:

99 → 9+9=18 → 1+8=9

98 → 9+8=17 → 1+7=8

97 → 9+7=16 → 1+6=7

96 → 9+6=15 → 1+5=6

95 → 9+5=14 → 1+4=5

94 → 9+4=13 → 1+3=4

93 → 9+3=12 → 1+2=3

92 → 9+2=11 → 1+1=2

91 → 9+1=10 → 1+0=1

90 → 9+0=9 → 9

We see a clear pattern: as we go down, the end result is always one less than the previous. Therefore, we are not only guaranteed that the sum of the digits is less than (or equal to) the number itself, but also that end result is uniformly distributed over 1 to 9.

In addition we could show that the same phenomenon occurs regardless of the base. If we repeat the exercise in base 17, we will have a uniform distribution of results, as we did for base 10 and 13.

*
* *

So, whatever you hash using this transform (birthday, SSN, you height, the conjunction of Pluto in the Aquarius quandragulum) is equally likely to land a “lucky 7” than a non-impressive 8 or 6 or whatever. Not that I really need to convince you that numerology is quackery, but we have certainly shown that this transform gives answers equally distributed over 1 to m, but that it’s not random enough to be used as, say, a checksum digit, since n will hash to h, but n+1 will hash to h+1~(\text{mod }m).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: