The Devil’s Digits

As I’ve said before, I love the way that numbers can come in many different guises. For example, take the number 21. It comes in all these guises:

21 = 10101 in base 2 = 210 in base 3 = 111 in b4 = 41 in b5 = 33 in b6 = 30 in b7 = 25 in b8 = 23 in b9 = 21 in b10 = 1A in b11 = 19 in b12 = 18 in b13 = 17 in b14 = 16 in b15 = 15 in b16 = 14 in b17 = 13 in b18 = 12 in b19 = 11 in b20 = 10 in b21

But I’ve not chosen 21 at random. If you sum the 1s in the representations of 21 in bases 2 to 21, look what you get:

21 = 10101 in base 2 = 210 in base 3 = 111 in b4 = 41 in b5 = 33 in b6 = 30 in b7 = 25 in b8 = 23 in b9 = 21 in b10 = 1A in b11 = 19 in b12 = 18 in b13 = 17 in b14 = 16 in b15 = 15 in b16 = 14 in b17 = 13 in b18 = 12 in b19 = 11 in b20 = 10 in b21


21 = 1s=101s=201s=3 in base 2 = 21s=40 in base 3 = 111s=7 in b4 = 41s=8 in b5 = 33 in b6 = 30 in b7 = 25 in b8 = 23 in b9 = 21s=9 in b10 = 1s=10A in b11 = 1s=119 in b12 = 1s=128 in b13 = 1s=137 in b14 = 1s=146 in b15 = 1s=155 in b16 = 1s=164 in b17 = 1s=173 in b18 = 1s=182 in b19 = 11s=20 in b20 = 1s=210 in b21


In other words, 21 = digcount(21,dig=1,base=2..21). But n = digcount(n,dig,b=2..n) doesn’t happen for any other digit and doesn’t happen often with 1:

3 = digcount(3,d=1,b=2..3) = 11 in b2 = 10 in b3
4 = digcount(4,d=1,b=2..4) = 100 in b2 = 11 in b3 = 10 in b4
6 = digcount(6,d=1,b=2..6) = 110 in b2 = 20 in b3 = 12 in b4 = 11 in b5 = 10 in b6
10 = digcount(10,d=1) = 1010 in b2 = 101 in b3 = 22 in b4 = 20 in b5 = 14 in b6 = 13 in b7 = 12 in b8 = 11 in b9 = 10 in b10
15 = digcount(15,d=1) = 1111 in b2 = 120 in b3 = 33 in b4 = 30 in b5 = 23 in b6 = 21 in b7 = 17 in b8 = 16 in b9 = 15 in b10 = 14 in b11 = 13 in b12 = 12 in b13 = 11 in b14 = 10 in b15
21 = digcount(21,d=1) = 10101 in b2 = 210 in b3 = 111 in b4 = 41 in b5 = 33 in b6 = 30 in b7 = 25 in b8 = 23 in b9 = 21 in b10 = 1A in b11 = 19 in b12 = 18 in b13 = 17 in b14 = 16 in b15 = 15 in b16 = 14 in b17 = 13 in b18 = 12 in b19 = 11 in b20 = 10 in b21


After that, the digcount(n,d=1,b=2..n) → n/2 (see “Digital Dissection” for further discussion). But I decided to look for the first n where digcount(n,dig,b=2..n) = 666:

digcount(1270,1) = 666
digcount(3770,2) = 666
digcount(7667,3) = 666
digcount(12184,4) = 666
digcount(18845,5) = 666
digcount(25806,6) = 666
digcount(34195,7) = 666
digcount(43352,8) = 666
digcount(54693,9) = 666


It doesn’t stop there, of course. You can carry on for ever, looking for digcount(n,A) = 666, digcount(n,B) = 666, digcount(n,C) = 666, where A = 10, B = 11 and C=12, and so on. But it doesn’t start there, either. What about digcount(n,0) = 666? That isn’t easy to find, because 0 usually occurs far less often than other digits in the representation of n. Here are the integers setting records for digcount(n,0,b=2..n):

2 → digcount(2,0) = 1 ← 2= 10 in base 2
4 → digcount(4,0) = 3; ← 4 = 100 in base 2, 11 in base 3, 10 in base 4
8 → digcount(8,0) = 5 ← 8 = 1000 in base 2, 22 in base 3, 20 in base 4, 13 in base 5, 12 in base 6, 11 in base 7, 10 in base 8
12 → digcount(12,0) = 6
16 → digcount(16,0) = 8
18 → digcount(18,0) = 9
32 → digcount(32,0) = 11
36 → digcount(36,0) = 13
64 → digcount(64,0) = 15
72 → digcount(72,0) = 18
128 → digcount(128,0) = 20
144 → digcount(144,0) = 24
252 → digcount(252,0) = 25
264 → digcount(264,0) = 27
288 → digcount(288,0) = 29
360 → digcount(360,0) = 30
504 → digcount(504,0) = 33
540 → digcount(540,0) = 36
720 → digcount(720,0) = 40
900 → digcount(900,0) = 42
1080 → digcount(1080,0) = 47
1680 → digcount(1680,0) = 48
1800 → digcount(1800,0) = 53
2160 → digcount(2160,0) = 56
2520 → digcount(2520,0) = 61
3600 → digcount(3600,0) = 64
4320 → digcount(4320,0) = 66


So what is the first n for which digcount(n,0) = 666? Watch this space.

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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.