OFFSET
1,3
COMMENTS
The primes to be inserted are: 2 between 1st and 2nd digit, or 5 between 2nd and 3rd digit, or 7 between 3rd and 4th digit, etc.
The prime 3 is excluded because it would restrict the terms to have no more than 4 digits; see A304244 and the Rivera link in A304243.
The two terms 27 and 87 are the only numbers (with more than one digit) for which 2, 5 or 7 can be inserted between any two digits to yield a prime: all of 227, 257, 277, 827, 857 an 877 are prime. There is no other such number with more than 2 digits.
LINKS
M. F. Hasler, Table of n, a(n) for n = 1..348 (all terms < 10^7).
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 1051 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+(k>1)), 10)*d[1]+p)*P)|| return)}
CROSSREFS
Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit), A304244 (prime(k) 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
AUTHOR
M. F. Hasler, May 21 2018
STATUS
approved