OFFSET
1,3
COMMENTS
The primes to insert are: 2 (after the first digit), 3 (after the second digit, if there are at least three), etc.
Inspired by A304243 and analog sequences given in cross-references.
The sequence is finite: if insertion of 3 after the second digit yields a prime, then the sum of digits must be congruent to 1 or 2 (mod 3). However, insertion of 2 after the first digit also must yield a prime, so only the second case is possible. But then, insertion of a digit 7 cannot yield a prime, so no term can have 5 digits or more. (Sequence A304243 circumvents this restriction by excluding 3 from the primes to insert, but it is still finite for a similar reason occurring later.)
LINKS
M. F. Hasler, Table of n, a(n) for n = 1..100 (complete sequence).
EXAMPLE
The 1-digit numbers 0..9 are included since the condition is voidly satisfied: Nothing can be inserted, therefore each of the resulting numbers is prime.
17 is in the sequence because 127 is prime.
101 is in the sequence because 1201 and 1031 are prime.
PROG
(PARI) is(n, L=logint(n+!n, 10)+1, d, p, P)={!for(k=1, L-1, isprime((d=divrem(n, P=10^(L-k)))[2]+(10^logint(10*p=prime(k), 10)*d[1]+p)*P)|| return)}
CROSSREFS
Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit).
Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended).
Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
Cf. A158232 (13 is prefixed or appended).
KEYWORD
nonn,base,fini,full
AUTHOR
M. F. Hasler, May 21 2018
STATUS
approved