Problem

Source: Canada RepĂȘchage 2024/2 CMOQR

Tags: number theory



Call a natural number $N$ good if its base $3$ expansion has no consecutive digits that are the same. For example, $289$ is good since its base $3$ representation is $1012013$. Find the $2024$th smallest good number ($0$ is not considered to be a natural number). Your answer should be in base $10$.