There is a solution given here but its very vague without explaining the mathematics/ concept behind it. Can someone please help derive the logic for framing an algorithm for this question?
One approach that crosses my mind is, we can think of this number system as also a binary one ( in 3 and 4, instead of 1 and 0) Thus, we could possibly convert the nth number to its corresponding binary format and replace 0 with 3 and 1 with 4. One problem here though is that say the nth number is 333. This in the regular (0 and 1) binary system would be 000 = 0, which evidently is wrong since the nth number is not 0.
How do we go about this question?
See bijective numeration, especially the algorithm that gives the digit-string representing the integer $m > 0$. (I.e., find the bijective base-2 expression for $m$, then replace each $1\to 3$ and each $2\to 4$.)