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.

Showing 1-1 of 1 results.

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

Original entry on oeis.org

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

Views

Author

Ivan N. Ianakiev, Mar 23 2015

Keywords

Examples

			111 is divisible by 3, and 212 is divisible by 2, but 313 is prime; therefore, a(1) = 313.
		

Crossrefs

Programs

  • 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
  • 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
  • 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
    
Showing 1-1 of 1 results.