Math Games

Evil Numbers

Ed Pegg Jr. and Chris Lomont, October 4, 2004

This calls for wisdom. If anyone has insight, let them calculate the number of the beast, for it is man's number. His number is 666. (Revelations 13:18)

The number 666 pops up a lot in recreational mathematics. Mike Keith has a whole page devoted to this number of the beast. Among the many tidbits recorded by Mike are the following:

Many of these items are also listed at the Beast Number entry for MathWorld. Ilan suggested the last item be added. Both pi and phi, π and φ, could be considered evil numbers. Evil numbers have the despicable property that if the digits following the decimal point are added one at a time, 666 will be hit exactly. It's like the game of 21, where you want to hit 21, without going over.

How common are evil numbers? This actually turns out to be a nice puzzle, which I put on mathpuzzle.com. (and answer below -- stop reading now if you wish to solve this on your own). There are 905 constants listed at the back of Steven Finch's marvelous book Mathematical Constants -- how many of them would be needed to make the list of evil constants complete? How much of a can of worms would it be to list all the evil constants?

A few additional evil constants were found in a search:

One can also sum the numbers in the continued fraction expansion.

Evil numbers are easy to find, as one might expect with an arbitrarily defined property. Interestingly, π is doubly evil. Many numbers aren't evil. For example, e isn't evil. The important sums are 665 and 668 after 141 decimal digits -- e goes over 666 without hitting it. Chris Lomont notes that you can take every 15th digit of e, and show that e is somewhat evil. The farthest he had to reach for any constant was with Catalan's constant, which wasn't evil until he took every 28th digit.

It appears that most numbers are at least somewhat evil. With enough fiddling, almost anything is likely to be findable.

How common are evil numbers? (number of non-zero digits / sum of digits) gives a good estimate. For a base 10 number, the estimate gives 9/(1+2+3+4+5+6+7+8+9) = 20% = 1/5. Thus, any random number has a 1 in 5 chance of having this property.

A fifth is an estimate. Chris Lomont found a recursion that could give an exact value:

p[1] = 1/9;
p[k_ /; k <10] := p[k] = 1/9 + 1/9 Sum[p[j], {j, 1, k - 1}];
p[k_ /; k > 9] := p[k] = 1/9 Sum[p[k - d], {d, 1, 9}];
Timing[Table[p[100 n], {n, 1, 10}]][[1]]

The exact probability of 666 being hit is the following:

67072003957152089994007282402178293562659723859308079417378010147917308504791408956458980115588098544832352934205821162785509634
85230993377867380331702382242879075141056463091273267522613022119595458383251811606223213231752711518628796615992836273541611782
86320855627805912128721785403206553968052878131979304380005960019846380120718415182202364564585324904903086554156659387123167015
73324633224832422285893860914002046100884872124694460106221093779764674439120107026353505325324218960202179039384702011311267763
179299063538588479967204114608449603102519994141366640807202899019238235033002199785195257797538993376610275501957173900000 /
33536001978576044997003641201089146781329861929654039708689005110281878355922229045653130860117009243602437612444487985379249452
20856459819880495994427577330654943353482814176675160859729463358552521964770847271879241023152490826991169494666723744093038776
09901968360690960798797733207697645087989638011051159364577735048320129953473337670032234611084893629797948842942103978486148804
56752725324127100147362376515318794618159057992657881675889944528332875911168011940196623255953573433495098996021537885152999277
9141186684943785466893262177304480300811071001875155800278795585897330179481023083090946366577527764009296902618035044877841

Which is approximately .2000000000000000000000000000000000000000000000000000000000000002166222683713523944720537405934866672. That's very close to 1/5. The third term in the continued fraction expansion of p[666] is 184653222869167741981875869102352405779668736930185085305398884.

The probability of evilness converges quickly to 1/5, but it does so in a highly oscillatory way. Note that each term is being multiplied by 1.243n.


Figure 1. ListPlot[Table[(1/5 - p[n]) (1243/1000)^n, {n, 30, 900}]]

Another method Chris Lomont discovered for calculating evilness involved the series expansion of (1-t9)/(t10-10t+9). In this series expansion, coefficients n is identical to p[n].

It seemed like there should be a closed form for all of this, but it was beyond Chris's ability to calculate. Also, I wasn't able to calculate the evilness probability for the continued fraction of a random irrational number. This calls for wisdom. If anyone has insight, let them calculate the equations.


References:

Steven Finch, Mathematical Constants, Cambridge University Press, 2003. http://pauillac.inria.fr/algo/bsolve/constant/constant.html.

Xavier Gourdon, "Constants and Records of Computation", http://numbers.computation.free.fr/Constants/Miscellaneous/Records.html.

Mike Keith, "The Number of the Beast", http://users.aol.com/s6sj7gt/mike666.htm.

Chris Lomont, "Angelic and Evil Numbers", http://www.math.purdue.edu/~clomont/EvilNumbers.nb.

Eric W. Weisstein. "Beast Number, Bloch Constant, Catalan's constant, Continued Fraction, Cube Line Picking, Euler Totient Function, Gauss Constant, Glaisher-Kinkelin Constant, Golden Ratio, Hard Hexagon Entropy Constant, Pi, Pi Continued Fraction, Pi Digits, Ramanujan Constant, Stieltjes Constants, " From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/.


Math Games archives.

Comments are welcome. Please send comments to Ed Pegg Jr. at ed@mathpuzzle.com.

Ed Pegg Jr. is the webmaster for mathpuzzle.com. He works at Wolfram Research, Inc. as an associate editor of MathWorld, and as administrator of the Mathematica Information Center.