Trying to answer this question, I have sketched a strategy:
- Find an integer $N$ "near" to $10^9$ with factors $5$ and $7$, that is, $5^n\cdot7^m$
- Conpute $k=N-\varphi(N)$ ($\varphi$ is the totient function). This is the number of multiples of $5$ or $7$ lesser than $N+1$. Think in $k$ as an estimation.
- If $N$ is really near from $10^9$ we can count by hand to fix $k$.
My question is: is there some efficient method to achieve the first step? I have written $10^9$ in base $35$ (it is $19.01.13.21.18.20$), but I'm stuck.
Generally speaking: given a positive integer $N$ and some primes $p_1,\ldots,p_k$ and a tolerance $T$, is there any efficient method to find nonnegative integers $n_1,\ldots,n_k$ such that $$|p_1^{n_1}\cdot\ldots\cdot p_k^{n_k}-N|\leq T$$ if they exist, or prove that they don't if that is the case?