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.

A090287 Smallest prime obtained by sandwiching n between a number with identical digits, or 0 if no such prime exists. Primes of the form k n k where all the digits of k are identical.

Original entry on oeis.org

101, 313, 727, 131, 11411, 151, 777767777, 373, 181, 191, 9109, 0, 7127, 331333, 991499, 1151, 3163, 1171, 1181, 9199, 1201, 112111, 0, 1231, 7247, 3253, 7777777777267777777777, 1111271111, 11128111, 1291, 1301, 3313, 1321, 0, 3343, 333533, 1361, 3373, 1381
Offset: 0

Views

Author

Amarnath Murthy, Nov 29 2003

Keywords

Comments

a(n) = 0 if n is a palindrome with even number of digits. Conjecture: No other term is zero.
The conjecture is false. a(231) = 0, a(420) = 0, a(n) = 0 if 11 divides n and n has an even number of digits. a(1414) has over 2000 digits. - Chai Wah Wu, Mar 31 2015

Crossrefs

Programs

  • Mathematica
    (* f(n) defined by José de Jesús Camacho Medina in A010785. *)
    lst={};f[m_]:=IntegerDigits[(m-9*Floor[(m-1)/9])*(10^Floor[(m+8)/9]-1)/9];
    g[n_]:=FromDigits[Flatten[{f[m],IntegerDigits[n],f[m]}]];
    Do[m=1;While[True,If[Mod[Length[IntegerDigits[n]],2]==0&&IntegerDigits[n]==Reverse[IntegerDigits[n]],
    AppendTo[lst,0];Break[],If[PrimeQ[g[n]],AppendTo[lst,g[n]];Break[]]];m++],{n,25}];
    lst (* Ivan N. Ianakiev, Mar 23 2015 *)
  • Python
    from gmpy2 import is_prime, mpz, digits
    def A090287(n, limit=2000):
        sn = str(n)
        if n in (231, 420, 759) or not (len(sn) % 2 or n % 11):
            return 0
        for i in range(1, limit+1):
            for j in range(1, 10, 2):
                si = digits(j, 10)*i
                p = mpz(si+sn+si)
                if is_prime(p):
                    return int(p)
        else:
            return 'search limit reached.' # Chai Wah Wu, Mar 31 2015

Extensions

a(0) from Chai Wah Wu, Mar 23 2015
a(26)-a(38) from Chai Wah Wu, Mar 24 2015