OFFSET
1,1
COMMENTS
The second Mathematica program below is more complicated than the first but is more efficient. It takes advantage of the observation that any number with a single digit one and one or more copies of another digit from among 2, 4, 5, 6, or 8 can only be prime if the one is the last (least significant) digit. Thus, there is no need to generate or test any permutations of such a number. This means that the program generates and tests only 37.5% as many candidate numbers as the first Mathematica program below. On my laptop computer, in 2019, the first Mathematica program took about 8.2 seconds to compute all terms containing up to 200 digits, whereas the second Mathematica program only took about 6.4 seconds to do the same. - Harvey P. Dale, Sep 20 2019
A further improvement could be made by not testing any permutations of one together with 2, 5, 8, 11, etc. copies of seven, since any such number will have a digital sum of a multiple of three and thus cannot be prime. - Harvey P. Dale, Sep 23 2019
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
MATHEMATICA
Select[Flatten[Table[FromDigits/@Permutations[PadRight[{1}, n, k]], {n, 10}, {k, Range[2, 9]}]], PrimeQ]//Union
Module[{nn=10, c1, c2}, c1=Select[Table[FromDigits[PadLeft[{1}, n, k]], {k, {2, 4, 5, 6, 8}}, {n, 2, nn}]//Flatten, PrimeQ]; c2=Select[FromDigits/@ Flatten[ Permutations/@Flatten[Table[PadLeft[{1}, n, k], {k, {3, 7, 9}}, {n, 2, nn}], 1], 1], PrimeQ]; Sort[Flatten[Join[{c1, c2}]]]] (* Harvey P. Dale, Sep 20 2019 *)
PROG
(PARI) lista(nn) = {forprime(p=1, nn, my(d = digits(p)); if ((#Set(d) == 2) && (#select(x->(x==1), d) == 1), print1(p, ", ")); ); } \\ Michel Marcus, Sep 11 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Harvey P. Dale, Sep 09 2019
STATUS
approved