A085238 Sort the numbers 2^i and 3^j. Then a(n) is the exponent of the n-th term.
0, 1, 1, 2, 3, 2, 4, 3, 5, 6, 4, 7, 5, 8, 9, 6, 10, 11, 7, 12, 8, 13, 14, 9, 15, 10, 16, 17, 11, 18, 19, 12, 20, 13, 21, 22, 14, 23, 15, 24, 25, 16, 26, 17, 27, 28, 18, 29, 30, 19, 31, 20, 32, 33, 21, 34, 22, 35, 36, 23, 37, 38, 24, 39, 25, 40, 41, 26, 42, 27, 43, 44, 28
Offset: 1
Keywords
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..500 from T. D. Noe)
Programs
-
Haskell
a085238 n = e (mod x 2 + 2) x where x = a006899 n e b p = if p == 1 then 0 else 1 + e b (p `div` b) -- Reinhard Zumkeller, Oct 09 2013
-
Mathematica
seq[lim_] := Module[{r2 = Range[0, Floor[Log2[lim]]], r3 = Range[0, Floor[Log[3, lim]]]}, Rest@ SortBy[Join[{#, 2^#} & /@ r2, {#, 3^#} & /@ r3], Last][[;; , 1]]]; seq[10^14] (* Amiram Eldar, Mar 25 2025 *)
-
PARI
do(lim)=my(v=List(vector(logint(lim\=1,2),i,1<my(t=valuation(n,2)); if(t, t, valuation(n,3)), Set(v)) \\ Charles R Greathouse IV, Sep 02 2015
-
Python
from sympy import integer_log def A085238(n): return k+1 if 6**(k:=integer_log(m:=3**(n-1),6)[0])<<1
Chai Wah Wu, Feb 04 2025