You will need to generate the smallest prime with
n digits, and it will only contain digits specified in the list
4 1 2
For this, you must generate the smallest prime with
4 digits, and that prime must only contain the digits
10 0 4 7
6 5 5 5 5 5 5 5 5 5 5 1 5 5 5 5 5 5 5 5 5 5
You can guarantee that the input will always be in the format you specify, and you can do anything if you get invalid input (such as the input being a single digit
If no such solution to an input exists, your program is allowed to do any of the following:
- Throw an error
- Run forever
- Anything else
Since this is code-golf, try to aim for the shortest code.
The input can be in any format you specify. For example, if you want your input to be like any of the following, that is fine.
4 [1, 2] [1,2]4 1,2 4 4 12
You can either write a program or a function, and it must either return the correct value or print it.
Whitespace is allowed anywhere.
This challenge inspired by A036229.