login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A318785
Numbers which are prime if each digit is replaced by its 9's complement.
2
2, 4, 6, 7, 10, 16, 20, 26, 28, 32, 38, 40, 46, 52, 56, 58, 62, 68, 70, 76, 80, 82, 86, 88, 92, 94, 96, 97, 112, 116, 118, 122, 136, 140, 142, 146, 160, 170, 172, 176, 178, 188, 190, 202, 212, 226, 230, 238, 242, 248, 256, 260, 266, 272, 280, 290, 298, 308, 316, 322, 326, 338, 340, 346, 352, 356, 358
OFFSET
1,1
EXAMPLE
32 belongs to this sequence as its 9's complement is 67, which is prime.
PROG
(Python)
nmax=500
def is_prime(num):
if num == 0 or num == 1: return(0)
for k in range(2, num):
if (num % k) == 0:
return(0)
return(1)
def c9(num):
s=str(num)
l=len(str(num))
n=""
for k in range(l):
n = n+str(9-int(s[k]))
return(int(n))
ris = ""
for i in range(2, nmax):
if is_prime(c9(i)):
ris = ris+str(i)+", "
print(ris)
(PARI) complement(n) = my(d=digits(n)); for(k=1, #d, d[k]=9-d[k]); subst(Pol(d), x, 10)
is(n) = ispseudoprime(complement(n)) \\ Felix Fröhlich, Sep 03 2018
CROSSREFS
Cf. A061601 (9's complement of n).
Sequence in context: A026398 A374432 A179003 * A190206 A189287 A189128
KEYWORD
nonn,base
AUTHOR
Pierandrea Formusa, Sep 03 2018
STATUS
approved