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-2 of 2 results.

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

A338366 a(n) = smallest positive number k with all digits equal such that the concatenation k||n||k is prime, or -1 if no such k exists.

Original entry on oeis.org

1, 3, 7, 1, 11, 1, 7777, 3, 1, 1, 9, -1, 7, 33, 99, 1, 3, 1, 1, 9, 1, 11, -1, 1, 7, 3, 7777777777, 1111, 111, 1, 1, 3, 1, -1, 3, 33, 1, 3, 1, 77777777777777, 111, 3, 1111111111111111111111111111111111111111, 3, -1, 1, 3, 1, 1, 999, 7, 1, 11, 1, 7, -1, 33, 1, 3, 3, 1, 3, 1
Offset: 0

Views

Author

N. J. A. Sloane, Nov 08 2020

Keywords

Comments

See A090287 for more information.
From Robert Price, Sep 20 2023: (Start)
For a(366), k is a string of 8441 1's.
The sequence then continues: 77, 1, 1, 3, 1, 1, 9, 7777777, 1, 11, 3, 1, 11, 9, 77, 11111, 1, 1, 33333, 3, 7, 9, 3, 1, 77, 1, 1, 9, 7777777777 until a(396) where k is a sequence of 269 1's.
The sequence then continues: 9, 777, 11, 9, 1, 7, 3, 7, 1, 11, 1, 1, 9, 9, 1111, 3, 999, 77777, 99, 7, 7, 3, 7, -1, 3, 1, 11, 77, 1, 77, 3, 1, 7, 3, 3, 1, 111111, 1, 7, 99, 7, 1111, 9, 1, 1, 11, 1, 7777777, 11, 1, 1111, 3, 1111, 7, 3, 7, 11, 3, 1, 1, 111, 3, 1, 3, 3, 1, 33, 9, 11, 33, 3, 7, 3, 3, 7, 99, 1, 1, 11, 3, 1, 9, 7, 77, 9, 1, 1, 3, 1, 7777, 33, 3, 1, 33, 3, 77, 77, 9, 1, 3, 33, 11111, 9, 9. (End)

Examples

			a(3) = 1 because 131 is prime.
a(4) = 11 because 11411 is prime, and all of 141, 242, 343, ..., 949 are composite.
		

Crossrefs

Cf. A090287.
Related sequences: A010785, A068695, A091088, A228323, A228325, A336893, A338712 (see also the Index link above).

Extensions

More terms from Alois P. Heinz, Nov 08 2020
Showing 1-2 of 2 results.