Letting $A=\{2^j\cdot 3^k| j,k \ \text{are non-negative integers} \}$, let us define $a_n$ as the $n$-th element of $A$ in ascending order.
We can see $$a_1=1, a_2=2,a_3=3,a_4=4,a_5=6,a_6=8,a_7=9,a_8=12,\cdots.$$
Then, here is my question.
Question : Could you show me a good way to get $a_n$ for large $n$ supposing that we can use computer? For example, how can we get $a_{2000},a_{5000},a_{10000},a_{50000}$ ?
Motivation : I've known a question about finding $a_{20},a_{50},a_{100}.$
My way is to prepare the following values.
$$a_{13}=2^5, a_{17}=2^6, a_{22}=2^7, \cdots, a_{48}=2^{11},a_{56}=2^{12},\cdots, a_{95}=2^{16},a_{106}=2^{17}$$ $$a_{12}=3^3, a_{19}=3^4, \cdots, a_{49}=3^{7},\cdots, a_{93}=3^{10},a_{111}=3^{11}$$
These values help us find $$a_{20}=2^5\cdot 3^1=96, a_{50}=2^8\cdot 3^2=2304, a_{100}=2^7\cdot 3^6=93312.$$
However, this idea has difficulty for finding $a_n$ for much larger $n$, so it seems that another idea would be needed. Can anyone help?
I used the following in PARI/GP
Here
ct(x)counts the numbers of the required form $\le x$ and then I do a binary search.This finally gave me $a_{50000}=2^{167}3^ {145}$. You need sufficient precision (e.g.
\p150) for this to work, at least as as many digits as the final result has. Iffactor(b,5)fails to find a complete factorization, the precision was obviously too low. A thorough check for sufficient precision would involve checking whenlog(n+.5)/log(2)is so close to an integer that the floor function might guess wrong; the trick of adding $\frac12$ before taking logarithm already tries to avoid much of this hassle.