Maximum number of primes in a number containing a total of n digits chosen from 1, 3, 7, and 9.
1, 3, 5, 8, 11, 14, 17, 21, 25, 29, 33, 37, 43, 47, 51, 55
1
For example, for two digits, the smallest solution is 37 because the number 37 has 3 primes 3, 7, and 37. For 3 digits, the smallest solution is 137 because 3, 7, 13, 37, and 137 are prime. The original puzzle was for numbers having 20 digits, which appears to be a difficult problem. See sequences S000858, for the least number containing the maximum number of primes, and S000859, for the number of numbers having the maximum number of primes.
After computing all 4^15 and 4^16 numbers, added 51 and 55. - T. D. Noe, May 02 2016
T. D. Noe, Plot of 16 terms
Carlos B. Rivera, Prime Puzzle 823: String of digits 1379 full of primes
(Mma) digits = {1, 3, 7, 9}; t = Table[mx = 0; cnt = 0; Do[d = digits[[IntegerDigits[i, 4, numLen] + 1]]; t2 = Union[Flatten[Table[FromDigits[Take[d, {i, j}]], {i, numLen}, {j, i, numLen}]]]; len = Length[Union[Select[t2, PrimeQ]]]; If[len == mx, cnt++, If[len > mx, mx = len; cnt = 1; dBest = FromDigits[d]]], {i, 0, 4^numLen - 1}]; Print[{numLen, mx, dBest, cnt}]; {mx, dBest, cnt}, {numLen, 10}]; Transpose[t][[1]]
Cf. A091633, S000858, S000859.
nonn,base,hard,more
T. D. Noe, Mar 29 2016