cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A250311 Numbers which produce primes if their prime factors, one by one, are prepended, inserted or appended.

This page as a plain text file.
%I A250311 #10 Nov 25 2014 10:17:34
%S A250311 49,131,133,149,151,157,169,173,179,191,197,199,223,233,239,247,277,
%T A250311 281,283,293,313,331,337,361,367,383,397,401,409,419,421,431,439,443,
%U A250311 457,463,467,469,481,503,547,553,571,577,587,589,607,641,643,659,673,679,701
%N A250311 Numbers which produce primes if their prime factors, one by one, are prepended, inserted or appended.
%H A250311 Paolo P. Lava, <a href="/A250311/b250311.txt">Table of n, a(n) for n = 1..1000</a>
%e A250311 Prime factors of a(1) = 49 are 7, 7 and concat(4,7,9) = 479 is prime.
%e A250311 a(2) = 131 is prime and concat(13,131,1) = 131311 is prime, as is concat(1,131,31) = 113131.
%e A250311 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.
%p A250311 with(numtheory): P:=proc(q) local a,b,c,f,g,h,j,k,n;
%p A250311 for n from 1 by 2 to q do a:=ifactors(n)[2]; h:=0;
%p A250311 for k from 1 to nops(a) do b:=ilog10(a[k][1])+1;
%p A250311 for j from 0 to ilog10(n)+1 do f:=(n mod 10^j);
%p A250311 if j=0 then c:=n*10^b+a[k][1]; else g:=a[k][1]*10^(ilog10(f)+1)+f;
%p A250311 c:=trunc(n/10^j)*10^(ilog10(g)+1)+g; fi;
%p A250311 if isprime(c) then h:=h+1; break; fi; od;
%p A250311 if h=nops(a) then print(n); fi; od; od; end: P(10^6);
%Y A250311 CF. A250312.
%K A250311 nonn,base,easy
%O A250311 1,1
%A A250311 _Paolo P. Lava_, Nov 18 2014