login
Number of nonoverlapping 666 substrings contained in the decimal expansion of the n-th apocalyptic number.
3

%I #21 Apr 10 2024 08:49:29

%S 1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,

%T 1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,

%U 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2

%N Number of nonoverlapping 666 substrings contained in the decimal expansion of the n-th apocalyptic number.

%C An apocalyptic number is a positive power of 2 containing 666 in its decimal expansion.

%C See A371809 for a variant where overlapping substrings are counted as distinct.

%H Paolo Xausa, <a href="/A371807/b371807.txt">Table of n, a(n) for n = 1..10000</a>

%H Brady Haran and Tony Padilla, <a href="https://www.youtube.com/watch?v=0LkBwCSMsX4">Apocalyptic Numbers</a>, YouTube Numberphile video, 2024.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/ApocalypticNumber.html">Apocalyptic Number</a>.

%F a(n) <= A371809(n).

%e a(4) = 2 because the 4th apocalyptic number (2^220) contains two nonoverlapping 666 substrings in its decimal expansion:

%e 2^220 = 168499(666)66969149871(666)88442938726917102321526408785780068975640576.

%t Select[StringCount[IntegerString[2^Range[1000]], "666"], # > 0 &]

%o (Python)

%o from itertools import islice

%o def agen(): # generator of terms

%o pow2 = 1

%o while True:

%o s = str(pow2)

%o if (c := s.count("666")) > 0: yield c

%o pow2 <<= 1

%o print(list(islice(agen(), 88))) # _Michael S. Branicky_, Apr 07 2024

%Y Cf. A007356, A371806, A371809.

%K nonn,easy,base

%O 1,4

%A _Paolo Xausa_, Apr 06 2024