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",") ) ) }

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",") ) ) }

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

A125665 Numbers such that both the left half of the digits and right half of the digits form a prime.

Original entry on oeis.org

2, 3, 5, 7, 22, 23, 25, 27, 32, 33, 35, 37, 52, 53, 55, 57, 72, 73, 75, 77, 202, 203, 205, 207, 212, 213, 215, 217, 222, 223, 225, 227, 232, 233, 235, 237, 242, 243, 245, 247, 252, 253, 255, 257, 262, 263, 265, 267, 272, 273, 275, 277, 282, 283, 285, 287, 292
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

			22 is the first number with this property having more than 1 digit.
		

Crossrefs

Cf. A125525.

Programs

  • Mathematica
    lhrhQ[n_]:=Module[{idn=IntegerDigits[n],len=Floor[IntegerLength[n]/2]}, And @@ PrimeQ[FromDigits/@{Take[idn,len],Take[idn,-len]}]]; Join[ {2,3,5,7}, Select[Range[300],lhrhQ]] (* Harvey P. Dale, Jul 05 2013 *)
  • PARI
    bothprime(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.