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

A258372 Smallest nonnegative number k not starting or ending with the digit 1 that forms a prime when it is sandwiched between n ones to the left of k and n ones to the right of k.

Original entry on oeis.org

0, 3, 4, 8, 36, 8, 5, 72, 28, 6, 79, 212, 23, 6, 73, 24, 52, 62, 3, 28, 220, 53, 75, 58, 228, 9, 265, 89, 214, 86, 215, 4, 7, 39, 295, 40, 87, 216, 97, 6, 264, 53, 287, 223, 4, 239, 259, 25, 57, 364, 49, 38, 93, 86, 27, 30, 80, 24, 6, 356, 50, 645, 395, 206
Offset: 1

Views

Author

Felix Fröhlich, May 28 2015

Keywords

Comments

n = 1 is the only case where a(n) = 0, since for any n > 1, A138148(n) is divisible by A002275(n).
No n exists such that a(n) = 2, since any number of the form A100706(n)+A011557(n) is of the form A000533(n)*A002275(n+1) (see comment by Robert Israel in A107123).
a(n) = 3 iff n is in A107123.
a(n) = 4 iff n is in A107124.
If k has an even number of digits and is a multiple of 11, then k is not a term. If k = (10^r+1)(10^m-1)/9 for some m > 0, r >= 0, then k is not a term. If A272232(k) = 0, then k is not a term. - Chai Wah Wu, Nov 08 2019

Examples

			a(1) = 0, because 101 is prime.
a(5) = 36, because the smallest x >= 0 such that 11111_x_11111 (where '_' denotes concatenation) is prime is 36. The decimal expansion of that prime is 111113611111.
		

Crossrefs

Programs

  • Mathematica
    Table[k = 0; s = Table[1, {n}]; While[Or[!PrimeQ[FromDigits[s ~Join~ IntegerDigits[k] ~Join~ s]], Or[First@ IntegerDigits@ k == 1, Last@ IntegerDigits@ k == 1]], k++]; k, {n, 64}] (* Michael De Vlieger, May 28 2015 *)
  • PARI
    a000042(n) = (10^n-1)/9
    a(n) = my(k=0); while(k==10 || k%10==1 || k\(10^(#Str(k)-1))==1 || !ispseudoprime(eval(Str(a000042(n), k, a000042(n)))), k++); k

A256481 Smallest prime obtained by appending a number with identical digits to n or 0 if no such prime exists.

Original entry on oeis.org

2, 11, 23, 31, 41, 53, 61, 71, 83, 97, 101, 113, 127, 131, 149, 151, 163, 173, 181, 191, 2011, 211, 223, 233, 241, 251, 263, 271, 281, 293, 307, 311, 3299, 331, 347, 353, 367, 373, 383, 397, 401, 419, 421, 431, 443, 457, 461, 479, 487, 491, 503, 511111, 521, 5333
Offset: 0

Views

Author

Chai Wah Wu, Mar 31 2015

Keywords

Comments

For n <= 15392, a(n) = 0 if and only if n = 6930. Conjecture: if a(n) = 0, then n is divisible by 3. Conjecture verified for n <= 10^6. a(n) = 0 for n = 6930, 50358, 56574, 72975.

Crossrefs

Programs

  • Python
    from gmpy2 import mpz, digits, is_prime
    def A256481(n,limit=2000):
        if n in (6930,50358,56574,72975):
            return 0
        if n == 0:
            return 2
        sn = str(n)
        for i in range(1,limit+1):
            for j in range(1,10,2):
                si = digits(j,10)*i
                p = mpz(sn+si)
                if is_prime(p):
                    return int(p)
        else:
            return 'search limit reached.'

A338712 Numbers with all digits equal and from the set {1, 3, 7, 9}.

Original entry on oeis.org

1, 3, 7, 9, 11, 33, 77, 99, 111, 333, 777, 999, 1111, 3333, 7777, 9999, 11111, 33333, 77777, 99999, 111111, 333333, 777777, 999999, 1111111, 3333333, 7777777, 9999999, 11111111, 33333333, 77777777, 99999999, 111111111, 333333333, 777777777, 999999999, 1111111111, 3333333333, 7777777777, 9999999999
Offset: 1

Views

Author

N. J. A. Sloane, Nov 08 2020, following a suggestion from Hugo Pfoertner

Keywords

Comments

Candidates for prefixes and suffixes in A090287.

Crossrefs

Programs

  • Maple
    a:= n-> [1, 3, 7, 9][1+irem(n-1, 4)]*(10^iquo(n+3, 4)-1)/9:
    seq(a(n), n=1..50);  # Alois P. Heinz, Nov 09 2020
  • Mathematica
    A338712={}; Do[AppendTo[A338712, FromDigits[ConstantArray[#,i]] & /@{ 1,3,7,9}], {i,10}]; A338712//Flatten (* Robert Price, Sep 21 2023 *)

Formula

From Colin Barker, Nov 09 2020: (Start)
G.f.: x*(1 + 3*x + 7*x^2 + 9*x^3) / ((1 - x)*(1 + x)*(1 + x^2)*(1 - 10*x^4)).
a(n) = 11*a(n-4) - 10*a(n-8) for n>8. (End)
Sum_{n>=1} 1/a(n) = (100/63) * A065444. - Amiram Eldar, Aug 31 2025

A256048 Smallest palindromic prime by adding at least one digit to both the left and right of n.

Original entry on oeis.org

101, 313, 727, 131, 11411, 151, 10601, 373, 181, 191, 30103, 1114111, 1120211, 11311, 11411, 31513, 1160611, 1117111, 18181, 71917, 30203, 1120211, 72227, 32323, 12421, 1250521, 36263, 12721, 12821, 39293, 10301, 11311, 32323, 13331, 14341, 33533, 16361, 77377
Offset: 0

Views

Author

Felix Fröhlich, Mar 10 2015

Keywords

Crossrefs

Programs

  • Python
    from _future_ import division
    from sympy import isprime
    def palgenrange2(m,l): # generator of odd-length palindromes of length at least m and at most 2*l
        if m == 1:
            yield 0
        for x in range(m//2+1,l+1):
            n = 10**(x-1)
            for y in range(n,n*10):
                s = str(y)
                yield int(s+s[-2::-1])
    def A256048(n):
        sn = str(n)
        for p in palgenrange2(len(sn)+2,len(sn)+20):
            if sn in str(p)[1:-1] and isprime(p):
                break
        else:
            return 'search limit reached'
        return p # Chai Wah Wu, Mar 22 2015

Extensions

a(10), a(12), a(16), a(18) corrected by Chai Wah Wu, Mar 22 2015

A256480 Smallest prime obtained by appending n to a nonzero number with identical digits or 0 if no such prime exists.

Original entry on oeis.org

0, 11, 0, 13, 0, 0, 0, 17, 0, 19, 0, 211, 0, 113, 0, 0, 0, 317, 0, 419, 0, 421, 0, 223, 0, 0, 0, 127, 0, 229, 0, 131, 0, 233, 0, 0, 0, 137, 0, 139, 0, 241, 0, 443, 0, 0, 0, 347, 0, 149, 0, 151, 0, 353, 0, 0, 0, 157, 0, 359, 0, 461, 0, 163, 0, 0, 0, 167, 0, 269
Offset: 0

Views

Author

Chai Wah Wu, Mar 31 2015

Keywords

Comments

a(n) = 0 if n is even or a multiple of 5. Conjecture: all other terms are nonzero. Conjecture verified for n <= 10^7.
"Appending" means "on the right".

Crossrefs

Programs

  • Python
    from gmpy2 import digits, mpz, is_prime
    def A256480(n,limit=2000):
        sn = str(n)
        if not (n % 2 and n % 5):
            return 0
        for i in range(1,limit+1):
            for j in range(1,10):
                si = digits(j,10)*i
                p = mpz(si+sn)
                if is_prime(p):
                    return int(p)
        else:
            return 'search limit reached.'

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

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