OFFSET
0,7
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..10000
EXAMPLE
The initial powers of 2, the largest proper substrings 2^k (or a dash "-"), and k (or -1):
n 2^n 2^k k
0 1 - -1
1 2 - -1
2 4 - -1
3 8 - -1
4 16 1 0
5 32 2 1
6 64 4 2
7 128 8 3
8 256 2 1
9 512 2 1
10 1024 4 2
11 2048 8 3
12 4096 4 2
13 8192 8 3
14 16384 16 4
15 32768 32 5
16 65536 - -1
17 131072 2 1
18 262144 4 2
19 524288 8 3
20 1048576 8 3
...
MATHEMATICA
Table[If[Length[#] == 0, -1, #[[-1, -1]]] &@ Reap[Block[{w = IntegerString[2^n], k = 0}, While[k < n, If[StringContainsQ[w, IntegerString[2^k]], Sow[k]]; k++]]][[-1]], {n, 0, 85}] (* Michael De Vlieger, Apr 26 2022 *)
PROG
(PARI) a(n) = {my(s = Str(2^n)); forstep (k=n-1, 0, -1, if (#strsplit(s, Str(2^k)) >= 2, return(k)); ); return(-1); \\ Michel Marcus, Apr 27 2022
(Python)
def a(n):
s = str(2**n)
for k in range(n-1, -1, -1):
if str(2**k) in s: return k
return -1
print([a(n) for n in range(86)]) # Michael S. Branicky, Apr 27 2022
CROSSREFS
KEYWORD
sign,base
AUTHOR
N. J. A. Sloane, Apr 26 2022
STATUS
approved