%I #58 Sep 16 2024 12:46:52
%S 1,2,4,6,9,13,17,22,28,34,41,48,56,65,74,84,95,106,118,130,143,157,
%T 171,186,202,218,235,253,271,290,309,329,350,371,393,416,439,463,487,
%U 512,538,564,591,619,647,676,706,736,767,798,830,863,896,930,965,1000,1036,1072
%N Index of 2^n within sequence of numbers of form 2^i*3^j (A003586).
%H Amiram Eldar, <a href="/A022331/b022331.txt">Table of n, a(n) for n = 0..10000</a> (terms 0..1000 from Zak Seidov)
%H Norman Carey, <a href="http://arxiv.org/abs/1303.0888">Lambda Words: A Class of Rich Words Defined Over an Infinite Alphabet</a>, arXiv preprint arXiv:1303.0888 [math.CO], 2013; <a href="https://cs.uwaterloo.ca/journals/JIS/VOL16/Carey/carey6.html">Lambda Words: A Class of Rich Words Defined Over an Infinite Alphabet</a>, J. Int. Seq. 16 (2013), Article 13.3.4.
%F a(n) = A071521(A000079(n)); A003586(a(n)) = A000079(n). - _Reinhard Zumkeller_, May 09 2006
%F a(n) ~ c * n^2, where c = log(2)/(2*log(3)) (A152747). - _Amiram Eldar_, Apr 07 2023
%t c[0] = 1; c[n_] := 1 + Sum[Ceiling[j*Log[3, 2]], {j, n}]; Table[c[i], {i, 0, 60}] (* _Norman Carey_, Jun 13 2012 *)
%o (PARI) a(n)=my(t=1);1+n+sum(k=1,n,logint(t*=2,3)) \\ _Ruud H.G. van Tol_, Nov 25 2022
%o (Python)
%o from sympy import integer_log
%o def A022331(n):
%o m = 1<<n
%o return sum((m//3**i).bit_length() for i in range(integer_log(m,3)[0]+1)) # _Chai Wah Wu_, Sep 16 2024
%Y Cf. A000079, A003586, A071521, A020915 (first differences), A152747.
%Y Cf. A022330 (index of 3^n within A003586).
%K nonn
%O 0,2
%A _Clark Kimberling_