login
A022329
Exponent of 3 (value of j) in n-th number of form 2^i*3^j (see A003586).
20
0, 0, 1, 0, 1, 0, 2, 1, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 4, 1, 3, 0, 2, 4, 1, 3, 5, 0, 2, 4, 1, 3, 5, 0, 2, 4, 6, 1, 3, 5, 0, 2, 4, 6, 1, 3, 5, 0, 7, 2, 4, 6, 1, 3, 5, 0, 7, 2, 4, 6, 1, 8, 3, 5, 0, 7, 2, 4, 6, 1, 8, 3, 5, 0, 7, 2, 9, 4, 6, 1, 8, 3, 5, 0, 7, 2, 9, 4, 6, 1, 8, 3, 10, 5, 0, 7, 2, 9, 4, 6, 1, 8, 3, 10, 5, 0, 7
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) = A069352(n) - A022328(n). - Reinhard Zumkeller, May 16 2015
A003586(n) = 2^A022328(n) * 3^a(n). - N. J. A. Sloane, Mar 19 2009
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
EXTENSIONS
Edited by N. J. A. Sloane, May 26 2024
STATUS
approved