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.

A252942 Smallest prime of the form "Concatenate(m,n,m)".

This page as a plain text file.
%I A252942 #41 Mar 16 2020 16:48:59
%S A252942 101,313,727,131,11411,151,13613,373,181,191,9109,131113,7127,171317,
%T A252942 131413,1151,3163,1171,1181,9199,1201,112111,172217,1231,7247,3253,
%U A252942 372637,172717,232823,1291,1301,3313,1321,233323,3343,273527,1361,3373,1381,173917,174017
%N A252942 Smallest prime of the form "Concatenate(m,n,m)".
%H A252942 Danny Rorabaugh, <a href="/A252942/b252942.txt">Table of n, a(n) for n = 0..10000</a>
%e A252942 111 is divisible by 3, and 212 is divisible by 2, but 313 is prime; therefore, a(1) = 313.
%p A252942 f:= proc(n) local dn, x, dx,p;
%p A252942   dn:= 10^(1+ilog10(n));
%p A252942   for x from 1 by 2 do if igcd(x,n) = 1 then
%p A252942      dx:= 10^(1+ilog10(x));
%p A252942      p:= x*(1+dx*dn)+n*dx;
%p A252942      if isprime(p) then return(p) fi
%p A252942   fi od
%p A252942 end proc:
%p A252942 101, seq(f(n), n=1..100); # _Robert Israel_, Apr 07 2015
%p A252942 # second Maple program:
%p A252942 a:= proc(n) local m, p; for m do
%p A252942       p:= parse(cat(m, n, m));
%p A252942       if isprime(p) then break fi od; p
%p A252942     end:
%p A252942 seq(a(n), n=0..50);  # _Alois P. Heinz_, Mar 16 2020
%t A252942 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
%o A252942 (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
%o A252942 (Sage)
%o A252942 def A252942(n):
%o A252942     m = 1
%o A252942     sn = str(n)
%o A252942     while True:
%o A252942         sm = str(m)
%o A252942         a = int(sm + sn + sm)
%o A252942         if is_prime(a):
%o A252942             return a
%o A252942         m += 2
%o A252942 A252942(40) # _Danny Rorabaugh_, Mar 31 2015
%o A252942 (Haskell)
%o A252942 a252942 n = head [y | m <- [1..],
%o A252942    let y = read (show m ++ show n ++ show m) :: Integer, a010051' y == 1]
%o A252942 -- _Reinhard Zumkeller_, Apr 08 2015
%Y A252942 Cf. A090287, A256048.
%Y A252942 Cf. A010051.
%K A252942 base,easy,nonn
%O A252942 0,1
%A A252942 _Ivan N. Ianakiev_, Mar 23 2015