%I #10 Feb 17 2019 23:38:26
%S 0,1,2,3,4,5,6,7,8,9,17,23,27,29,41,51,53,77,81,83,87,89,99,101,149,
%T 191,239,251,287,317,353,359,419,473,497,509,527,533,611,677,743,797,
%U 809,821,887,893,941,983,1037,1043,1277,1421,1841,1853,1973,1979,2543
%N Numbers that yield a prime when prime(k) is inserted after the k-th digit, for any k >= 1, k < number of digits.
%C The primes to insert are: 2 (after the first digit), 3 (after the second digit, if there are at least three), etc.
%C Inspired by A304243 and analog sequences given in cross-references.
%C 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.)
%H M. F. Hasler, <a href="/A304244/b304244.txt">Table of n, a(n) for n = 1..100</a> (complete sequence).
%e 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.
%e 17 is in the sequence because 127 is prime.
%e 101 is in the sequence because 1201 and 1031 are prime.
%o (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)}
%Y Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit).
%Y Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended).
%Y Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these).
%Y Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).
%Y Cf. A069833 (9 is prefixed, appended or inserted anywhere), A215421 (primes among these).
%Y Cf. A158232 (13 is prefixed or appended).
%Y Cf. A164329 (0 is inserted), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (0 is inserted between all digits).
%K nonn,base,fini,full
%O 1,3
%A _M. F. Hasler_, May 21 2018
|