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

A125525 Centrist primes: primes such that both the right half and the left half of the prime are prime.

Original entry on oeis.org

2, 3, 5, 7, 23, 37, 53, 73, 223, 227, 233, 257, 263, 277, 283, 293, 307, 313, 317, 337, 347, 353, 367, 373, 383, 397, 503, 523, 547, 557, 563, 577, 587, 593, 727, 733, 743, 757, 773, 787, 797, 1103, 1117, 1123, 1129, 1153, 1171, 1303, 1307, 1319, 1361, 1367
Offset: 1

Views

Author

Cino Hilliard, Jan 22 2007

Keywords

Comments

If the length of n > 9 is odd then the central number is not used in the calculation. So neither the left half nor the right half will contain the central digit. If the length of n is even, then all numbers are used. My guess is there are infinitely many of these numbers.
Number of n-digit terms for n=1..9: {4, 4, 33, 92, 1100, 3223, 37611, 130607, 1590017}. - Zak Seidov, Feb 19 2015

Examples

			The left half of 23 is 2 which is prime. The right half is 3 which is also prime so 23 is a centrist prime. [Corrected by _N. J. A. Sloane_, Jan 12 2019]
		

Crossrefs

Programs

  • PARI
    left(str, n) = /* Get the left n characters from string str */ { my(v, tmp, x); v =""; tmp = Vec(str); ln=length(tmp); if(n > ln, n=ln); for(x=1, n, v=concat(v, tmp[x]); ); return(v) }
    right(str, n) = /* Get the right n characters from string str.*/ { my(v, ln, s, x); v =""; tmp = Vec(str); ln=length(tmp); if(n > ln, n=ln); s = ln-n+1; for(x=s, ln, v=concat(v, tmp[x]); ); return(v) }
    /* Political primes, Centrist case */ rep(n) = { my(x,ln,y,lp,rp); forprime(x=2,n, y=Str(x); if(x > 9, ln=floor(length(y)/2), ln=1); lp = eval(left(y,ln)); rp = eval(right(y,ln)); if(isprime(lp)&& isprime(rp),print1(x",") ) ) }

Extensions

Offset changed to 1 by Zak Seidov, Feb 19 2015

A125523 Democratic primes: primes such that the left half of the prime is prime and the right half is not.

Original entry on oeis.org

29, 31, 59, 71, 79, 211, 229, 239, 241, 251, 269, 271, 281, 311, 331, 349, 359, 379, 389, 509, 521, 541, 569, 571, 599, 701, 709, 719, 739, 751, 761, 769, 1109, 1151, 1163, 1181, 1187, 1193, 1301, 1321, 1327, 1381, 1399, 1709, 1721, 1733, 1777, 1787, 1901
Offset: 2

Views

Author

Cino Hilliard, Jan 22 2007

Keywords

Comments

If the length of n is odd then the central number is not used in the calculation. So neither the left half nor the right half will contain the central digit. If the length of n is even, then all numbers are used.

Examples

			The left half of 29 is 2, which is prime. The right half is 9, which is not prime.
The left half of 211 is 2, which is prime. The right half is 1, which is not prime.
		

Crossrefs

Programs

  • PARI
    /* Political primes, democratic case. */ dem(n) = { local(x,ln,y,lp,rp); forprime(x=2,n, y=Str(x); if(x > 9, ln=floor(length(y)/2), ln=1); lp = eval(left(y,ln)); rp = eval(right(y,ln)); if(isprime(lp)&& !isprime(rp),print1(x",") ) ) }

A125664 Numbers such that the right half of the digits form a prime and the left half do not.

Original entry on oeis.org

12, 13, 15, 17, 42, 43, 45, 47, 62, 63, 65, 67, 82, 83, 85, 87, 92, 93, 95, 97, 102, 103, 105, 107, 112, 113, 115, 117, 122, 123, 125, 127, 132, 133, 135, 137, 142, 143, 145, 147, 152, 153, 155, 157, 162, 163, 165, 167, 172, 173, 175, 177, 182, 183, 185, 187
Offset: 1

Views

Author

Cino Hilliard, Jan 29 2007

Keywords

Comments

If the number of digits in the number is odd > 1, then the middle digit is ignored.

Examples

			12 is the first number with this property.
		

Crossrefs

Cf. A125524.

Programs

  • PARI
    rightprime(n) = { local(x,ln,y,lp,rp); for(x=1,n, y=Str(x); if(x > 9, ln=floor(length(y)/2), ln=1); lp = eval(left(y,ln)); rp = eval(right(y,ln)); if(!isprime(lp)&& isprime(rp),print1(x",") ) ) }
    
  • Python
    from sympy import isprime
    def ok(n):
        if n < 10: return False
        s = str(n)
        m = len(s)//2
        return isprime(int(s[-m:])) and not isprime(int(s[:m]))
    print([k for k in range(188) if ok(k)]) # Michael S. Branicky, Dec 13 2021

Formula

The left half of an n-digit number is the first floor(n/2) digits. The right half of an n-digit number is the last floor(n/2) digits.

A337508 Primes such that neither the left half nor the right half of the prime is prime.

Original entry on oeis.org

11, 19, 41, 61, 89, 101, 109, 131, 139, 149, 151, 179, 181, 191, 199, 401, 409, 419, 421, 431, 439, 449, 461, 479, 491, 499, 601, 619, 631, 641, 659, 661, 691, 809, 811, 821, 829, 839, 859, 881, 911, 919, 929, 941, 971, 991, 1009, 1021, 1033, 1039, 1049, 1051
Offset: 1

Views

Author

Iain Fox, Aug 30 2020

Keywords

Comments

For n > 9, the center digit is not considered when making the calculation. For a prime number to be in this sequence, both the substring to the left of the center and the substring to the right of the center must be nonprime.
If a number appears in this sequence, it will not appear in A125523, A125524, or A125525.
A000040 is the union of this sequence, A125523, A125524, and A125525.

Examples

			479 is prime. The left part of (4)79 is not prime. The right part of 47(9) is not prime.
		

Crossrefs

Programs

  • Maple
    q:= n-> isprime(n) and (s-> (h-> not ormap(x-> isprime(parse(x)),
            [s[1..h], s[-h..-1]]))(iquo(length(s), 2)))(""||n):
    select(q, [$11..2000])[];  # Alois P. Heinz, Sep 14 2020
  • Mathematica
    lhrhQ[p_]:=Module[{idp=IntegerDigits[p],c},c=Floor[Length[idp]/2];AllTrue[ {FromDigits[ Take[idp,c]],FromDigits[Take[idp,-c]]},!PrimeQ[#]&]]; Select[Prime[Range[5,200]],lhrhQ] (* Harvey P. Dale, Aug 09 2023 *)
  • PARI
    lista(nn) = forprime(p=11, nn, my(l=#Str(p), e=floor(l/2), left=floor(p/10^(e+l%2)), right=p-floor(p/10^e)*10^e); if(!isprime(left) && !isprime(right), print1(p, ", ")))
    
  • Python
    from sympy import nextprime, isprime
    A337508_list, p = [], 11
    while p < 10**6:
        s = str(p)
        l = len(s)//2
        if not (isprime(int(s[:l])) or isprime(int(s[-l:]))):
            A337508_list.append(p)
        p = nextprime(p) # Chai Wah Wu, Sep 14 2020

A385404 Numbers that can be split into two at any place between their digits such that the resulting numbers are always a nonprime on the left and a prime on the right.

Original entry on oeis.org

12, 13, 15, 17, 42, 43, 45, 47, 62, 63, 65, 67, 82, 83, 85, 87, 92, 93, 95, 97, 123, 143, 147, 153, 167, 183, 423, 443, 447, 453, 467, 483, 497, 623, 637, 643, 647, 653, 667, 683, 697, 813, 817, 823, 843, 847, 853, 867, 873, 883, 913, 917, 923, 937, 943, 947, 953, 967, 983, 997
Offset: 1

Views

Author

Tamas Sandor Nagy, Jun 27 2025

Keywords

Comments

As no leading zeros are allowed, all terms are zeroless.
From Michael S. Branicky, Jun 27 2025: (Start)
Finite since each term with first digit removed must be a member of A024785, which is finite.
Last term here is a(7407) = 6357686312646216567629137. (End)

Examples

			637 is a term because when it is split in two in all possible ways, it first results in 63, a nonprime, and 3, a prime. When split in the second and final possible way, it results in 6, a nonprime, and 37, a prime.
		

Crossrefs

Programs

  • Mathematica
    q[n_] := !MemberQ[IntegerDigits[n], 0] && AllTrue[Range[IntegerLength[n]-1], PrimeQ[QuotientRemainder[n, 10^#]] == {False, True} &]; Select[Range[10, 1000], q] (* Amiram Eldar, Jun 27 2025 *)
  • Python
    from sympy import isprime
    def ok(n): return '0' not in (s:=str(n)) and len(s) > 1 and all(not isprime(int(s[:i])) and isprime(int(s[i:])) for i in range(1, len(s)))
    print([k for k in range(1000) if ok(k)]) # Michael S. Branicky, Jun 27 2025
    
  • Python
    # uses import and function ok above
    from itertools import count, islice, product
    def agen():  # generator of terms
        tp = list("23579")  # set of left-truncatable primes
        for d in count(2):
            tpnew = []
            for f in "123456789":
                for e in tp:
                    if isprime(int(s:=f+e)):
                        tpnew.append(s)
                    if ok(t:=int(f+e)):
                        yield t
            tp = tpnew
            if len(tp) == 0:
                return
    afull = list(agen())
    print(afull[:60]) # Michael S. Branicky, Jun 27 2025
Showing 1-5 of 5 results.