cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A022329 Exponent of 3 (value of j) in n-th number of form 2^i*3^j (see A003586).

This page as a plain text file.
%I A022329 #40 Sep 16 2024 12:39:53
%S A022329 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,
%T A022329 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,
%U A022329 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
%N A022329 Exponent of 3 (value of j) in n-th number of form 2^i*3^j (see A003586).
%H A022329 Reinhard Zumkeller, <a href="/A022329/b022329.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from Franklin T. Adams-Watters)
%F A022329 a(n) = A069352(n) - A022328(n). - _Reinhard Zumkeller_, May 16 2015
%F A022329 A003586(n) = 2^A022328(n) * 3^a(n). - _N. J. A. Sloane_, Mar 19 2009
%F A022329 a(n) = A191476(n) - 1. - _Franklin T. Adams-Watters_, Mar 19 2009
%t A022329 IntegerExponent[Select[Range[10^5], # == 2^IntegerExponent[#, 2] * 3^IntegerExponent[#, 3] &], 3] (* _Amiram Eldar_, Apr 15 2024 *)
%o A022329 (Haskell)
%o A022329 a022329 n = a022329_list !! (n-1)
%o A022329 -- Where a022329_list is defined in A022328.
%o A022329 -- _Reinhard Zumkeller_, Nov 19 2015, May 16 2015
%o A022329 (Python)
%o A022329 from sympy import integer_log
%o A022329 def A022329(n):
%o A022329     def bisection(f,kmin=0,kmax=1):
%o A022329         while f(kmax) > kmax: kmax <<= 1
%o A022329         while kmax-kmin > 1:
%o A022329             kmid = kmax+kmin>>1
%o A022329             if f(kmid) <= kmid:
%o A022329                 kmax = kmid
%o A022329             else:
%o A022329                 kmin = kmid
%o A022329         return kmax
%o A022329     def f(x): return n+x-sum((x//3**i).bit_length() for i in range(integer_log(x,3)[0]+1))
%o A022329     return integer_log((m:=bisection(f,n,n))>>(~m&m-1).bit_length(),3)[0] # _Chai Wah Wu_, Sep 15 2024
%Y A022329 Cf. A003586, A022328, A191476. - _Franklin T. Adams-Watters_, Mar 19 2009
%Y A022329 Cf. A069352.
%K A022329 nonn
%O A022329 1,7
%A A022329 _Clark Kimberling_
%E A022329 Edited by _N. J. A. Sloane_, May 26 2024