OFFSET
1,2
COMMENTS
Signature sequence of log_2(3) (A020857). - R. J. Mathar, May 27 2024
LINKS
EXAMPLE
MATHEMATICA
mx = 1000000; t = Select[Sort[Flatten[Table[2^i 3^j, {i, Log[2, mx]}, {j, Log[3, mx]}]]], # <= mx &]; Table[FactorInteger[i][[1, 2]], {i, t}] (* T. D. Noe, Aug 31 2012 *)
PROG
(Python)
from sympy import integer_log
def A191475(n):
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
def f(x): return n+x-sum((x//3**i).bit_length() for i in range(integer_log(x, 3)[0]+1))
return 1+(~(m:=bisection(f, n, n))&m-1).bit_length() # Chai Wah Wu, Sep 15 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Aug 30 2012
EXTENSIONS
Edited by N. J. A. Sloane, May 26 2024
STATUS
approved