|
|
A280660
|
|
Least k such that at least half of the last n digits of 2^k are 9.
|
|
1
|
|
|
12, 53, 53, 232, 93, 1862, 93, 3244, 93, 93, 93, 55754, 12864, 55756, 23353, 361353, 16441, 361353, 304362, 361353, 361353, 361353, 361353, 3748854, 3748854, 78055893, 66290232, 119133355, 119133355, 379371432, 20958353, 130883333, 20958353, 130883333
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
2,1
|
|
COMMENTS
|
See the Mathematical Reflections link for a proof that a(n) exists for all n>1.
|
|
LINKS
|
|
|
EXAMPLE
|
For n=2, k=12 with 2^k = 4096.
|
|
MAPLE
|
a:= proc(n) local m, t, k, c, h; m, t:= 10^n, 2048;
for k from 12 do t:= 2*t mod m; h, c:= t, 0;
while h>0 do if irem(h, 10, 'h')=9 then c:= c+2 fi od;
if c >= n then return k fi
od
end:
|
|
PROG
|
(PARI) a(n) = my(k = 1, ok = 0); until (ok, vd = Vecrev(digits(2^k)); nb = sum(j=1, min(n, #vd), vd[j]==9); ok = (nb >= n/2); if (! ok, k++); ); k;
(Python)
m, k, l = 10**n, 1, 2
while True:
if 2*str(l).count('9') >= n:
return k
k += 1
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|