The construction of a number with given digits

79 Views Asked by At

Given a set of decimal digits. And given a set of primes $\mathbb{P}$, find some $p \in \mathbb{P}$ such that $p^n, n \in \mathbb{N} $ contained in itself all the digites from a given set, and it does not matter in what order.

3

There are 3 best solutions below

6
On

More is true:

For any finite sequence of decimal digits, there is a power of $2$ whose decimal expansion begins with these sequence.

See here for a proof. For algorithms, see this question.

On the other hand, I've just run a computer search and every allowed subset of digits are the digits of a prime less than 304456880. Not all subsets of digits are allowed, of course: those whose sum is a multiple of $3$ are not. Nor are those solely composed of even digits. I've found $78$ forbidden subsets.

0
On

Remark: this answer pertains to the initial version of the question. The current edit restricts the search to powers within a given set of primes.

Another theoretically "cheap" way to look for prime powers that contain a given set of digits is to concatenate the $n$ digits, append a $1$ to get an $(n+1)$-digit number $d$ and then apply Dirichlet's theorem on primes in arithmetic progressions to the progression $10^{n+2}m+d$ for $m=1,2,3,\ldots$. (Appending the $1$ is necessary when, for example, the given digits are all even, in order to get a number $d$ that is relatively prime to $10$.) Dirichlet's theorem guarantees you'll find a prime, which can be checked for successive values of $m$ using, say, the AKS primality test if $n$ is large. If $n$ is small, say $n\approx10$, just about any primality test will do. Furthermore, the Prime Number Theorem (for primes in arithmetic progression) suggests you should find a prime relatively quickly.

7
On

$2^{100}=1267650600228229401496703205376$ includes all the digits so it will answer your request for any set.

For any given prime it is believed that there is a highest power that does not contain all the digits, so if your list of primes doesn't include $2$ I would just raise one of them to the $1000$ power and expect it to be good. Proving that there is a highest power seems to be hard.