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

A125524 Republican primes: primes such that the right half of the prime is prime and the left half is not.

Original entry on oeis.org

13, 17, 43, 47, 67, 83, 97, 103, 107, 113, 127, 137, 157, 163, 167, 173, 193, 197, 433, 443, 457, 463, 467, 487, 607, 613, 617, 643, 647, 653, 673, 677, 683, 823, 827, 853, 857, 863, 877, 883, 887, 907, 937, 947, 953, 967, 977, 983, 997, 1013, 1019, 1031
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 right half of 13 is 3, which is prime. The left half is 1, which is not prime.
The right half of 113 is 3, which is prime. The left half is 1, which is not prime.
		

Crossrefs

Programs

  • PARI
    /* Political primes, republican case. */ rep(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",") ) ) }

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

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

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

Original entry on oeis.org

20, 21, 24, 26, 28, 29, 30, 31, 34, 36, 38, 39, 50, 51, 54, 56, 58, 59, 70, 71, 74, 76, 78, 79, 200, 201, 204, 206, 208, 209, 210, 211, 214, 216, 218, 219, 220, 221, 224, 226, 228, 229, 230, 231, 234, 236, 238, 239, 240, 241, 244, 246, 248, 249, 250, 251, 254, 256
Offset: 1

Views

Author

Cino Hilliard, Jan 29 2007

Keywords

Comments

If n is odd > 1 then the middle digit is ignored.

Examples

			20 is the first number with this property.
		

Crossrefs

Cf. A125523.

Programs

  • PARI
    leftprime(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",") ) ) }

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