login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A352924 In the decimal expansion of 2^n, the proper substring which is the largest power of 2 is 2^a(n); a(n) = -1 if no proper substring of 2^n is a power of 2. 1
-1, -1, -1, -1, 0, 1, 2, 3, 1, 1, 2, 3, 2, 3, 4, 5, -1, 1, 2, 3, 3, 1, 2, 3, 4, 5, 6, 3, 3, 3, 3, 6, 2, 3, 3, 3, 3, 3, 3, 3, 4, 5, 3, 3, 4, 5, 6, 5, 3, 2, 3, 3, 2, 2, 3, 3, 2, 3, 3, 6, 3, 3, 4, 3, 4, 5, 6, 6, 3, 3, 4, 5, 6, 5, 3, 4, 5, 6, 2, 3, 3, 4, 5, 6, 4, 5 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,7
LINKS
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
Cf. A000079.
Sequence in context: A212811 A338854 A330957 * A327192 A351651 A157813
KEYWORD
sign,base
AUTHOR
N. J. A. Sloane, Apr 26 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 11:31 EDT 2024. Contains 371792 sequences. (Running on oeis4.)