Given a positive integer as input, output the smallest positive integer such that appending its digits (in base 10) to the end of the input number will form a prime number.
Examples
1 --> 1
2 --> 3
8 --> 3
9 --> 7
11 --> 3
20 --> 11
43 --> 1
134 --> 11
3492 --> 11
3493 --> 9
65595 --> 19
Rules and Scoring
- This is code golf, so shortest code wins
- Standard rules and loopholes apply
- Use any convenient I/O format
- The largest concatenated number (which is larger than both the input and output) your solution supports must be at least \$2^{53} - 1\$. (This is the largest odd integer that can be represented with double precision floats)
- Leading zeros should not be added to numbers before appending them to the input number
- Primality tests must be exact
x * 10^n + m
when we append base-10 digits.) Or maybe "make it a multiple of 7" or "11" or something is easier to test without sqrt functions, just a single modulo, so simplifies brute-force and is even more likely to allow some neat math. \$\endgroup\$