login
Primes in the concatenation n,n+1, n+2, n+1, n.
1

%I #15 Sep 04 2024 18:40:41

%S 34543,1718191817,2324252423,3334353433,3940414039,7778797877,

%T 8788898887,123124125124123,153154155154153,159160161160159,

%U 173174175174173,207208209208207,227228229228227,279280281280279

%N Primes in the concatenation n,n+1, n+2, n+1, n.

%H Vincenzo Librandi, <a href="/A068703/b068703.txt">Table of n, a(n) for n = 1..1000</a>

%e 1718191817 is a term as the concatenation of 17,18,19,18 and 17.

%p for n from 1 to 1500 do a := n+10^( floor(evalf(log(n)/log(10))+0.0000000001 )+1)*(n+1); a := a+10^( floor(evalf(log(a)/log(10))+0.0000000001 )+1)*(n+2); a := a+10^( floor(evalf(log(a)/log(10))+0.0000000001 )+1)*(n+1); a := a+10^( floor(evalf(log(a)/log(10))+0.0000000001 )+1)*n; b[n] := a:end do:k := 0:for n from 2 to 1500 doif(isprime(b[n]) ) then k := k+1:c[k] := b[n]:end if:end do:seq(c[j],j=1..k);

%t Select[Table[FromDigits[Flatten[{IntegerDigits[n], IntegerDigits[n+1], IntegerDigits[n+2], IntegerDigits[n+1], IntegerDigits[n], {}}]], {n, 1000}], PrimeQ] (* _Vincenzo Librandi_, Mar 13 2013 *)

%t Select[Table[FromDigits[Flatten[IntegerDigits/@Join[Range[n,n+2],Range[n+1,n,-1]]]],{n,300}] PrimeQ] (* _Harvey P. Dale_, Sep 04 2024 *)

%o (Magma) [m: n in [1..300] | IsPrime(m) where m is Seqint([] cat Intseq(n) cat Intseq(n+1) cat Intseq(n+2) cat Intseq(n+1) cat Intseq(n))]; // _Vincenzo Librandi_, Mar 13 2013

%K nonn,base

%O 1,1

%A _Amarnath Murthy_, Mar 04 2002

%E More terms from _Sascha Kurz_, Mar 27 2002