A363873 Least k such that 2^k begins with n but is not exactly n.
4, 8, 5, 12, 9, 6, 46, 13, 53, 10, 50, 7, 17, 47, 77, 14, 34, 54, 84, 11, 31, 51, 61, 81, 8, 18, 38, 48, 68, 78, 98, 15, 25, 35, 45, 55, 75, 85, 95, 12, 22, 32, 42, 145, 52, 62, 72, 82, 92, 102, 9, 19, 29, 39, 142, 49, 59, 162, 69, 79, 89, 192, 99, 109, 16, 119, 26, 36, 139, 46
Offset: 1
Examples
a(1) = 4 since 2^4 = 16 starts with 1 and is not 1 itself (the way 2^0 = 1 would be); a(2) = 8 (not 1: 2^1 = 2) since 2^8 = 256; a(3) = 5 since 2^5 = 32; a(4) = 12 (not 2: 2^2 = 4) since 2^12 = 4096; a(5) = 9 since 2^9 = 512; etc.
Programs
-
Mathematica
a[n_] := Block[{j = IntegerLength@ n, k = 1}, While[ IntegerLength[2^k] < j || Quotient[2^k, 10^(IntegerLength[2^k] - j)] != n || n == 2^k, k++]; k]; Array[ a, 70]
-
Python
def A363873(n): m, s = 1<<(k:=n.bit_length()-1), str(n) while m<=n or not str(m).startswith(s): k += 1 m <<= 1 return k # Chai Wah Wu, Aug 06 2023
Comments