OFFSET
1,7
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000 (first 1000 terms from Franklin T. Adams-Watters)
FORMULA
a(n) = A191476(n) - 1. - Franklin T. Adams-Watters, Mar 19 2009
MATHEMATICA
IntegerExponent[Select[Range[10^5], # == 2^IntegerExponent[#, 2] * 3^IntegerExponent[#, 3] &], 3] (* Amiram Eldar, Apr 15 2024 *)
PROG
(Haskell)
a022329 n = a022329_list !! (n-1)
-- Where a022329_list is defined in A022328.
-- Reinhard Zumkeller, Nov 19 2015, May 16 2015
(Python)
from sympy import integer_log
def A022329(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 integer_log((m:=bisection(f, n, n))>>(~m&m-1).bit_length(), 3)[0] # Chai Wah Wu, Sep 15 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
Edited by N. J. A. Sloane, May 26 2024
STATUS
approved