OFFSET
1,1
LINKS
Paolo P. Lava, Table of n, a(n) for n = 1..1000
EXAMPLE
Prime factors of a(1) = 49 are 7, 7 and concat(4,7,9) = 479 is prime.
a(2) = 131 is prime and concat(13,131,1) = 131311 is prime, as is concat(1,131,31) = 113131.
Prime factors of a(3) = 14383 are 19, 757. Then, concat(1,19,4383) = 1194383 is prime and concat(1438,757,3) = is prime, as is concat(14,757,383) = 14757383.
MAPLE
with(numtheory): P:=proc(q) local a, b, c, f, g, h, j, k, n;
for n from 1 by 2 to q do a:=ifactors(n)[2]; h:=0;
for k from 1 to nops(a) do b:=ilog10(a[k][1])+1;
for j from 0 to ilog10(n)+1 do f:=(n mod 10^j);
if j=0 then c:=n*10^b+a[k][1]; else g:=a[k][1]*10^(ilog10(f)+1)+f;
c:=trunc(n/10^j)*10^(ilog10(g)+1)+g; fi;
if isprime(c) then h:=h+1; break; fi; od;
if h=nops(a) then print(n); fi; od; od; end: P(10^6);
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Paolo P. Lava, Nov 18 2014
STATUS
approved