113257 contains the first 6 primes as sub-strings when reading them from left to right:
2: 113257
3: 113257
5: 113257
7: 113257
11: 113257
13: 113257
What is the smallest number that contains the first 11 primes as sub-strings?
Good luck!
Puzzling Stack Exchange is a question and answer site for those who create, solve, and study puzzles. It only takes a minute to sign up.
Sign up to join this community113257 contains the first 6 primes as sub-strings when reading them from left to right:
2: 113257
3: 113257
5: 113257
7: 113257
11: 113257
13: 113257
What is the smallest number that contains the first 11 primes as sub-strings?
Good luck!
Given the first 11 primes:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31
We can observe that:
Therefore, our final number needs to be 5x2 (remaining double digits) + 1 (overlapped teen) + 1 (remaining 5) = 12 digits long.
Arranging things from smallest to largest, I believe that the smallest number containing the first 11 primes is:
113,171,923,295
Or for completeness:
2: 113,171,923,295
3: 113,171,923,295
5: 113,171,923,295
7: 113,171,923,295
11: 113,171,923,295
13: 113,171,923,295
17: 113,171,923,295
19: 113,171,923,295
23: 113,171,923,295
29: 113,171,923,295
31: 113,171,923,295
113171923295 (12 digits)
.......2_
..3_
...........5
....7_
11_
.13_
...17_
.....19_
.......23_
.........29_
..31_
Primes are
2 3 5 7 11 13 17 19 23 29 31. We can combine 2, 3, and 23; 17 and 7. If we stick 23 and 19 next to each other we can get 31. To minimize, we will use the smallest first digits, as much as possible: 11, then 13. We will then need a 19 and 29 at the end, followed by the final 5. There are a maximum of 18 digits in the number; since the 2, 3, and 7 are combined this is 15 digits. The second 1 in the 11 and the 31 can be shared with the first 1 in either 13, 17, 19, so this reduces by 2 digits. The first digit in the 31 can be shared by the last 3 in the 13 or 23, so this reduces by another digit. I think this means that the minimum number of digits to accomplish everything is 12, so hopefully my number below works.
So potentially we could have
113172319295, which yields
113172319295
113172319295
113172319295
113172319295
113172319295
113172319295
113172319295
113172319295
113172319295
113172319295
113172319295
A nice algorithm to generate the series
The first 11 prime numbers are
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31
Sorting them lexicographically we get
11, 13, 17, 19, 2, 23, 29, 3, 31, 5, 7
or as a single number
111317192232933157
Step-1 Remove all repetitive numbers (not digits) (highlighted in bold)
111317192232933157
113171923293157
Step-2 Traversing from left to right, remove any numbers from the first 11 primes already seen
┌─────────┐
↓ ↓
11317192329 31 5 7
↑ ↑
└────────────┘
Step-3. Verify.
2: 113171923295 3: 113171923295
5: 113171923295
7: 113171923295 11: 113171923295
13: 113171923295 17: 113171923295
19: 113171923295
23: 113171923295
29: 113171923295
31: 113171923295
Answer
113171923295