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:

- φ/2 +
*sin*(666) = 0. (φ is the Golden Ratio) - φ(666) = 6·6·6. (Here, φ(n) is the Euler Totient Function)
- 666 = 1
^{6}- 2^{6}+ 3^{6}. - 666 = 2² + 3² + 5² + 7² + 11² + 13² + 17²
- The first 144 decimal digits of π sum to 666.
- The first 146 decimal digits of φ sum to 666. (new, found by Ilan Honig)

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:

- The first 132 decimal digits of the Ramanujan constant sum to 666. (262537412640768743.999999999999250072597 ...)
- The first 137 decimal digits of the hard hexagon entropy constant sum to 666. (1.395485972479302735229500663566 ...)
- The first 141 decimal digits of the first Stieltjes constant sum to 666. (-0.072815845483676724860586375874901319 ...)
- The first 144 decimal digits of π sum to 666. (3.141592653589793238462643383279502884197169399375105820 ...)
- The first 146 decimal digits of φ sum to 666. (1.618033988749894848204586834365638117720309179805762862 ...)
- The first 146 decimal digits of 3
^{1/2}sum to 666. (1.7320508075688772935274463415058723669428052538103806 ...) - The first 153 decimal digits of the Glaisher-Kinkelin constant sum to 666. (1.282427129100622636875342568869791 ...)
- The first 154 decimal digits of the Cube Line Picking constant sum to 666. (0.66170718226717623515583113324841 ...)
- The first 155 decimal digits of 2
^{1/3}sum to 666. (1.2599210498948731647672106072782283505702514647015079 ...)

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

- The first 51 numbers in the CF of the Cube Line Picking constant sum to 666. (0, 1, 1, 1, 21, 1, 2, 1, 4, 10, 1, 2, 2, 1, ...)
- The first 57 numbers in the CF of π sum to 666. (3, 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, 1, 84, 2, 1, ...)
- The first 59 numbers in the CF of the Bloch constant sum to 666. (0, 2, 8, 2, 1, 1, 2, 102, 1, 4, 2, 2, 4, 1, 3, 3, 1, 1, 1, ...)
- The first 144 numbers in the CF of the Gauss constant sum to 666. (0, 1, 5, 21, 3, 4, 14, 1, 1, 1, 1, 1, 3, 1, 15, 1, 3, 8, ...)
- The first 174 numbers in the CF of the Landau Constant sum to 666. (0, 1, 1, 5, 3, 1, 1, 2, 1, 1, 6, 3, 1, 8, 11, 2, 1, 1, ...)

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.243^{n}.

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-t^{9})/(t^{10}-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/.

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.