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.

A318785 Numbers which are prime if each digit is replaced by its 9's complement.

This page as a plain text file.
%I A318785 #18 Sep 05 2018 15:12:35
%S A318785 2,4,6,7,10,16,20,26,28,32,38,40,46,52,56,58,62,68,70,76,80,82,86,88,
%T A318785 92,94,96,97,112,116,118,122,136,140,142,146,160,170,172,176,178,188,
%U A318785 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
%N A318785 Numbers which are prime if each digit is replaced by its 9's complement.
%e A318785 32 belongs to this sequence as its 9's complement is 67, which is prime.
%o A318785 (Python)
%o A318785 nmax=500
%o A318785 def is_prime(num):
%o A318785     if num == 0 or num == 1: return(0)
%o A318785     for k in range(2, num):
%o A318785        if (num % k) == 0:
%o A318785            return(0)
%o A318785     return(1)
%o A318785 def c9(num):
%o A318785     s=str(num)
%o A318785     l=len(str(num))
%o A318785     n=""
%o A318785     for k in range(l):
%o A318785         n = n+str(9-int(s[k]))
%o A318785     return(int(n))
%o A318785 ris = ""
%o A318785 for i in range(2,nmax):
%o A318785     if is_prime(c9(i)):
%o A318785        ris = ris+str(i)+","
%o A318785 print(ris)
%o A318785 (PARI) complement(n) = my(d=digits(n)); for(k=1, #d, d[k]=9-d[k]); subst(Pol(d), x, 10)
%o A318785 is(n) = ispseudoprime(complement(n)) \\ _Felix Fröhlich_, Sep 03 2018
%Y A318785 Cf. A061601 (9's complement of n).
%K A318785 nonn,base
%O A318785 1,1
%A A318785 _Pierandrea Formusa_, Sep 03 2018