A125664 Numbers such that the right half of the digits form a prime and the left half do not.
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
Examples
12 is the first number with this property.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
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.
Comments