The Number of the Beast


Mike Keith His website

The number 666 is cool. Made famous by the Book of Revelation (Chapter 13, verse 18, to be exact), it has also been studied extensively by mathematicians because of its many interesting properties. Here is a compendium of mathematical facts about the number 666. Most of the well-known "chestnuts" are included, but many are relatively new and have not been published elsewhere.


The number 666 is a simple sum and difference of the first three 6th powers:

666 = 16 - 26 + 36.


It is also equal to the sum of its digits plus the cubes of its digits:

666 = 6 + 6 + 6 + 6³ + 6³ + 6³.

There are only five other positive integers with this property. Exercise: find them, and prove they are the only ones!


666 is related to (6² + n²) in the following interesting ways:

666 = (6 + 6 + 6) · (6² + 1²)
666 = 6! · (6² + 1²) / (6² + 2²)


The sum of the squares of the first 7 primes is 666:

666 = 2² + 3² + 5² + 7² + 11² + 13² + 17²


The sum of the first 144 (= (6+6)·(6+6)) digits of pi is 666.


16661 is the first beastly palindromic prime, of the form 1[0...0]666[0...0]1. The next one after 16661 is

1000000000000066600000000000001

which can be written concisely using the notation 1 013 666 013 1, where the subscript tells how many consecutive zeros there are. Harvey Dubner determined that the first 7 numbers of this type have subscripts 0, 13, 42, 506, 608, 2472, and 2623 [see J. Rec. Math, 26(4)].


A very special kind of prime number [first mentioned to me by G. L. Honaker, Jr.] is a prime, p (that is, let's say, the kth prime number) in which the sum of the decimal digits of p is equal to the sum of the digits of k. The beastly palindromic prime number 16661 is such a number, since it is the 1928'th prime, and

1 + 6 + 6 + 6 + 1 = 1 + 9 + 2 + 8.


The triplet (216, 630, 666) is a Pythagorean triplet, as pointed out to me by Monte Zerger. This fact can be rewritten in the following nice form:

(6·6·6)² + (666 - 6·6)² = 666²


There are only two known Pythagorean triangles whose area is a repdigit number:

(3, 4, 5) with area 6
(693, 1924, 2045) with area 666666

It is not known whether there are any others, though a computer search has verified that there are none with area less than 1040.  [see J. Rec. Math, 26(4), Problem 2097 by Monte Zerger]


The sequence of palindromic primes begins 2, 3, 5, 7, 11, 101, 131, 151, 181, 191, 313, 353, etc. Taking the last two of these, we discover that 666 is the sum of two consecutive palindromic primes:

666 = 313 + 353.


A well-known remarkably good approximation to pi is 355/113 = 3.1415929... If one part of this fraction is reversed and added to the other part, we get

553 + 113 = 666.


[from Martin Gardner's "Dr. Matrix" columns] The Dewey Decimal System classification number for "Numerology" is 133.335. If you reverse this and add, you get

133.335 + 533.331 = 666.666


[from G. L. Honaker, Jr.] There are exactly 6 6's in 6666. There are also exactly 6 6's in the previous sentence!


[by P. De Geest, slight refinement by M. Keith] The number 666 is equal to the sum of the digits of its 47th power, and is also equal to the sum of the digits of its 51st power. That is,

66647 = 5049969684420796753173148798405564772941516295265
4081881176326689365404466160330686530288898927188
59670297563286219594665904733945856
66651 = 9935407575913859403342635113412959807238586374694
3100899712069131346071328296758253023455821491848
0960748972838900637634215694097683599029436416

and the sum of the digits on the right hand side is, in both cases, 666. In fact, 666 is the only integer greater than one with this property. (Also, note that from the two powers, 47 and 51, we get (4+7)(5+1) = 66.)


The number 666 is one of only two positive integers equal to the sum of the cubes of the digits in its square, plus the digits in its cube. On the one hand, we have

6662 = 443556
6663 = 295408296

while at the same time,

(43 + 43 + 33 + 53 + 53 + 63) + (2+9+5+4+0+8+2+9+6) = 666.

The other number with this property is 2583.

We can state properties like this concisely be defining Sk(n) to be the sum of the kth powers of the digits of n. Then we can summarize items #13, #14, and #2 on this page by simply writing:

666 = S2(666) + S3(666)
  = S1(66647
  = S1(66651)
  = S3(6662) + S1(6663)

[P. De Geest and G. L. Honaker, Jr.] Now that we have the Sk(n) notation, define SP(n) as the sum of the first n palindromic primes. Then:

S3( SP(666) ) = 3 · 666

where the same digits (3, 666) appear on both sides of the equation!


[by Carlos Rivera] The number 20772199 is the smallest integer with the property that the sum of the prime factors of n and the sum of the prime factors of n+1 are both equal to 666:

20772199 = 7 x 41 x 157 x 461, and 7+41+157+461 = 666
20772200 = 2x2x2x5x5x283x367, and 2+2+2+5+5+283+367 = 666.

Of course, integers n and n+1 having the same sum of prime factors are the famous Ruth-Aaron pairs. So we can say that (20772199, 20772200) is the smallest beastly Ruth-Aaron pair.


[by G. L. Honaker, Jr.] The sum of the first 666 primes contains 666:

2 + 3 + 5 + 7 + 11 · · · + 4969 + 4973 = 1533157 = 23 · 66659


[Wang, J. Rec. Math, 26(3)] The number 666 is related to the golden ratio! (If a rectangle has the property that cutting off a square from it leaves a rectangle whose proportions are the same as the original, then that rectangle's proportions are in the golden ratio. Also, the golden ratio is the limit, as n becomes large, of the ratio between adjacent numbers in the Fibonacci sequence.) Denoting the Golden Ratio by t, we have the following identity, where the angles are in degrees:

sin(666) = cos(6·6·6) = -t/2

which can be combined into the lovely expression:

t = - (sin(666) + cos(6·6·6) )


There are exactly two ways to insert '+' signs into the sequence 123456789 to make the sum 666, and exactly one way for the sequence 987654321:

666 = 1 + 2 + 3 + 4 + 567 + 89 = 123 + 456 + 78 + 9
666 = 9 + 87 + 6 + 543 + 21


A Smith number is an integer in which the sum of its digits is equal to the sum of the digits of its prime factors. 666 is a Smith number, since

666 = 2·3·3·37

while at the same time

6 + 6 + 6 = 2 + 3 + 3 + 3 + 7.


Consider integers n with the following special property: if n is written in binary, then the one's complement is taken (which changes all 1's to 0's and all 0's to 1's), then the result is written in reverse, the result is the starting integer n. The first few such numbers are

2 10 12 38 42 52 56 142 150 170 178 204 212 232 240 542 558 598 614...

For example, 38 is 100110, which complemented is 011001, which reversed is 100110. Now, you don't really need to be told what the next one after 614 is, do you?


The following fact is quite well known, but still interesting: If you write the first 6 Roman numerals, in order from largest to smallest, you get 666:

DCLXVI = 666.


The previous one suggests a form of word play that was popular several centuries ago: the chronogram. A chronogram attaches a numerical value to an English phrase or sentence by summing up the values of any Roman numerals it contains. (Back then, U,V and I,J were often considered the same letter for the purpose of the chronogram, however I prefer to distinguish them.) What's the best English chronogram for 666? My offering is a statement about, perhaps, what you should do when you encounter the number 666:

Expect The Devil.

Note that four of the six numerals are contained in the last word.


A standard function in number theory is phi(n), which is the number of integers smaller than n and relatively prime to n. Remarkably,

phi(666) = 6·6·6.


The nth triangular number is given by the formula T(n) = (n)(n+1)/2, and is equal to the sum of the numbers from 1 to n.

666 is the 36th triangular number - in other words,

T(6·6) = 666.

In 1975 Ballew and Weger proved (see J. Rec. Math, Vol. 8, No. 2):

666 is the largest triangular number that's also a repdigit

(A repdigit is a number consisting of a single repeated non-zero digit, like 11 or 22 or 555555.)


The doubly-triangular numbers are those numbers of the form T(T(n)), where T(n) are the triangular numbers defined in the previous item.  The sequence of doubly-triangular numbers begins

1, 6, 21, 55, 120, 321, 406, 666, 1035

so we see that 666 is the eighth doubly-triangular number (i.e., T(T(8)) = 666). 

The nth doubly-triangular number is, among other things, the number of ways to paint the vertices of a square using a set of n colors, where the colors are distinct but rotations and reflections of a given colored square are considered the same.  So there are 666 distinct ways of painting the vertices of a square with a set of eight colors.


[from Monte Zerger]  6 (= T(3)), 66 (= T(11)), and 666 (= T(36)) are all triangular numbers in base 10.  These three numbers are also triangular in two other bases: 49 and 2040:

(6)49 = 6 = T(3)
(66)49 = 300 = T(24)
(666)49 = 14706 = T(171)

(6)2040 = 6 = T(3)
(66)2040 = 12246 = T(1564)
(666)2040 = 24981846 = T(7068)


[from Monte Zerger]  6666 = 87266061345623616, which contains 6 6's.  In addition, the digits of 6666 can be split into two sets in two different ways, both of which sum up to the same value, 36 (= 6 x 6).

The first eight and last nine digits both sum to 36:

8 + 7 + 2 + 6 + 6 + 0 + 6 + 1 = 6 x 6 = 3 + 4 + 5 + 6 + 2 + 3 + 6 + 1 + 6

while the 6's and non-6's also add up to 36:

6 + 6 + 6 + 6 + 6 + 6 = 6 x 6 = 8 + 7 + 2 + 0 + 1 + 3 + 4 + 5 + 2 + 3 + 1

Finally, note that 6666 is almost pandigital - the only digit it's missing is an upside-down 6 (i.e., 9).


A polygonal number is a positive integer of the form

P(k,n) = n((k - 2)n + 4 - k)/2

where k is the 'order' of the polygonal number (k=3 gives the triangular numbers, k=4 the squares, k=5 the pentagonal numbers, etc.), and n is its index. A repdigit polygonal number is a polygonal number that also happens to be a repdigit. Finally, define the wickedness of a polygonal number as n/k. Now, an amazing fact:

666 is conjectured to be the most wicked repdigit polygonal number.

Since 666 = P(3,36), its wickedness value is n/k = 12. I recently showed by computer calculation that there are no counterexamples to this conjecture less than 1050. See my paper here for more details. It seems quite certain that this is true but so far no one has proved it.


Whilst on the subject of polygonal numbers, we can find among them some rather beastly configurations. One of the more striking is the following:

If one arranges a group of people in a solid 3010529326318802-sided polygon with 666 people on each side, there will be a total of 666666666666666666666 persons in all.

Or, more simply, P(3010529326318802, 666) = 666666666666666666666. See the paper link in the previous item for more like this.


Define pi(n,d) as the d consecutive decimal digits of pi starting at the nth digit after the decimal point. Then we can make the following pretty statement:

pi(666, 3) = 7·7·7 (since the digits at that position are "343", or 7 cubed)

as well as the following one, which contains nothing but 6's and 3's (and two 666's):

pi(666 · 3.663663663..., 3) = 666.


Inserting zeros between the sixes in 666 gives the number 60606, which has a few interesting properties of its own:

60606 = 7 x 13 x 666 = 91 x 666 = T(13) x T(36) - i.e., 60606 is the product of two triangular numbers.

60606 = 7 x 37 x (13 x 18), which is interesting in that Rev 13:18 is the place where 666 is mentioned.

60606 = P(7,156) - i.e., 60606 is a 7-gonal number. (Note that this can be written entirely using the evocative numbers 6, 7, and 13, by saying 60606 = P(7, (6+6)·13)). In addition we can make a statement using only 7's:

60606 is the 7th palindromic 7-gonal number.

60606 has exactly 6 prime factors.

60606+1 is a prime number. Not only that, but it's a prime (p) for which the period length of the decimal expansion of its reciprocal (1/p) attains the maximum possible value of p-1. In other words:

1/(60606 + 1) has period length 60606.

60606 is, just like 666, the sum of two consecutive palindromic primes (both of which contain the evil eyes!):

60606 = 30203 + 30403.

[Thanks to G. L. Honaker, Jr., Jud McCranie, Monte Zerger, and Patrick De Geest for these.]


It might be worthwile to explore the double-wide-beast number (666666). Besides the obvious 666666 = 1001 x 666, Patrick De Geest points out that 666666 is a palindrome in both base 10 and base 16 (hex-adecimal - get it?), where its value is A2C2A. He also notes that in base 31 it is MBMB, which just like 666666 (made of two 666's) is formed by concatenating two identical parts (MB). Perhaps MB could be read as Multiple Beast.


[found by Jud McCranie] It is a theorem that every positive integer occurs as the period length of the reciprocal of some prime. So, the obvious question arises: what's the smallest prime with period length 666? The answer was found in June 1998:

p = 902659997773 is the smallest prime whose reciprocal has period length 666.

The first 666 digits after the decimal point of 1/p (which then repeat) are:

000000000001107836840523732794015856393629176199911567364459
553453849096605279881838076680979988886781773038423114524370
500571392445408560228574284480352437836776725525116619485115
892576776519141738094220028289530945207260114524370499463555
604884827434558428086723261636865158160657066031266795971496
637303661413240039402749172168836999999999998892163159476267
205984143606370823800088432635540446546150903394720118161923
319020011113218226961576885475629499428607554591439771425715
519647562163223274474883380514884107423223480858261905779971
710469054792739885475629500536444395115172565441571913276738
363134841839342933968733204028503362696338586759960597250827
831163

Note: if you turn the prime p upside down, there's a 666 inside, slightly to the left of the middle, and if you turn the single period of 1/p upside down, there's a 66666666666 inside, slightly to the left of the middle!


[from Simon Whitechapel] A mathematically important number sequence is:

7, 17, 19, 23, 29, 47, 59, 61, 97, 109, 113, 131, 149, ...

which is the sequence of primes p whose reciprocal in base 10 has maximum period p-1. The last one, 1/149 with period 148, has the following digits after the decimal point (which then repeat):

0067114093959731543624161073825503355
7046979865771812080536912751677852348
9932885906040268456375838926174496644
2953020134228187919463087248322147651

As luck would have it, the sum of these is 666. If these 148 numbers (the first 148 digits of 1/149) are written as the top row of a 148x148 square grid, and then the digits of 2/149 as the second row, then 3/149 and so on, the result is a 148x148 pseudo-magic square, in which every row and column sums to 666.


[sent in by P. De Geest] The smallest prime number with a gap of 666 (that is, such that the prime following it is larger than it by exactly 666) is

18691113008663

Note the three sixes!


Define a dottable fraction as one in which dots (representing multiplication) can be interspersed in both the numerator and denominator to produce an expression that's equal to the original fraction. The noteworthy dottable fraction

 666   =   6·6·6 
 64676     6·46·76 

has a numerator of 666 and a denominator of the form 6x6y6.


Here's another one (actually, two) based on a fraction [by Manley Perkel and Mike Keith].  The fraction 1666/6664 (which has a 666 in both numerator and denominator) has two interesting properties:

(1) The numerical value of the fraction (0.25) is the same as the numerical value of the fraction you get by "canceling" (i.e., erasing or removing) the 666 from both the numerator and denominator.

(2) The value of the fraction is the same as the value you get by splitting the fraction in half and multiplying the two parts together; that is,

1666  =  16 . 66
6664     66   64
A fraction like this is known as a fractured fraction.

The alphametic below has a unique solution (i.e., there is only one way to replace letters with digits so that the addition sum is correct):

   SIX
   SIX
   SIX
+BEAST
 SATAN

[by Monte Zerger] Note that 1998 (a recent year) = 666 + 666 + 666. Not only that, but if we set A=3, B=6, C=9, etc., we find, amazingly, that

NINETEEN NINETY EIGHT = 666

Frank Fiederer points out that the age of the United States in 1998 is also related to 666, since

1998 - 1776 = 666/3.


Finally, we close with an observation that makes a commentary on the folly of attaching a specific meaning to the number 666. If the letter A is defined to be equal to 36 (=6·6), B=37, C=38, and so on, then:

The sum of the letters in the word SUPERSTITIOUS is 666.


To Mike's home page