login
A252942
Smallest prime of the form "Concatenate(m,n,m)".
1
101, 313, 727, 131, 11411, 151, 13613, 373, 181, 191, 9109, 131113, 7127, 171317, 131413, 1151, 3163, 1171, 1181, 9199, 1201, 112111, 172217, 1231, 7247, 3253, 372637, 172717, 232823, 1291, 1301, 3313, 1321, 233323, 3343, 273527, 1361, 3373, 1381, 173917, 174017
OFFSET
0,1
LINKS
EXAMPLE
111 is divisible by 3, and 212 is divisible by 2, but 313 is prime; therefore, a(1) = 313.
MAPLE
f:= proc(n) local dn, x, dx, p;
dn:= 10^(1+ilog10(n));
for x from 1 by 2 do if igcd(x, n) = 1 then
dx:= 10^(1+ilog10(x));
p:= x*(1+dx*dn)+n*dx;
if isprime(p) then return(p) fi
fi od
end proc:
101, seq(f(n), n=1..100); # Robert Israel, Apr 07 2015
# second Maple program:
a:= proc(n) local m, p; for m do
p:= parse(cat(m, n, m));
if isprime(p) then break fi od; p
end:
seq(a(n), n=0..50); # Alois P. Heinz, Mar 16 2020
MATHEMATICA
mnmPrimes = {}; f[m_, n_] := FromDigits[Flatten[{IntegerDigits[m], IntegerDigits[n], IntegerDigits[m]}]]; Do[m = 1; While[True, If[PrimeQ[f[m, n]], AppendTo[mnmPrimes, f[m, n]]; Break[]]; m+=2], {n, 0, 40}]; mnmPrimes
PROG
(PARI) a(n) = {m=1; while (! isprime(p=eval(concat(Str(m), concat(Str(n), Str(m))))), m+=2); p; } \\ Michel Marcus, Mar 23 2015
(Sage)
def A252942(n):
m = 1
sn = str(n)
while True:
sm = str(m)
a = int(sm + sn + sm)
if is_prime(a):
return a
m += 2
A252942(40) # Danny Rorabaugh, Mar 31 2015
(Haskell)
a252942 n = head [y | m <- [1..],
let y = read (show m ++ show n ++ show m) :: Integer, a010051' y == 1]
-- Reinhard Zumkeller, Apr 08 2015
CROSSREFS
Cf. A010051.
Sequence in context: A195294 A142578 A256048 * A090287 A134971 A082770
KEYWORD
base,easy,nonn
AUTHOR
Ivan N. Ianakiev, Mar 23 2015
STATUS
approved