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.
%I A228629 #16 Oct 06 2020 19:28:47 %S A228629 2,7,23,61,67,83,107,109,127,163,167,181,211,223,227,239,241,251,263, %T A228629 269,271,277,283,293,307,367,383,389,401,409,421,461,463,467,487,509, %U A228629 521,523,563,587,601,607,613,617,631,641,643,647,653,661,673,677,683,701 %N A228629 Members p of a pair of primes (p,q) such that the decimal digits of q are the 9's complement of the decimal digits of p. %C A228629 We consider length(p) = length(q). For example, the primes p = 97, 997, 99999999999999997,...(see A003618) are not in the sequence with q = 2. %C A228629 Each prime p appears only once in the sequence, but the pair (p, q) is not unique, for example the prime 163 generates two pairs of primes(163, 683) and (163, 863), the prime 283 generates three pairs of primes(283, 167), (283, 617) and (283, 761). %C A228629 The couples of primes (p, q) are (2, 7), (7, 2), (23, 67), (61, 83), (67, 23), (83, 61), (107, 829), (109, 809), (127, 827),... %C A228629 In the general case, the digits of p are different from q, but there exists numbers p such that q has the same digits as p, for example (p, q) = (227, 277), (727, 227), (881, 181), ... %H A228629 Robert Israel, <a href="/A228629/b228629.txt">Table of n, a(n) for n = 1..10000</a> %e A228629 23 is in the sequence because 9-2 = 7 and 9 - 3 = 6 => 67 is prime, and we obtain the pair (23, 67). %p A228629 with(numtheory):kk:=0: %p A228629 for n from 1 to 200 do: %p A228629 ii:=0: %p A228629 for k from 1 to 2000 while(ii=0) do: %p A228629 p1:=ithprime(n):p2:=ithprime(k): %p A228629 x1:=convert(p1,base,10):n1:=nops(x1): %p A228629 x2:=convert(p2,base,10):n2:=nops(x2): %p A228629 if n1=n2 then %p A228629 W:=array(1..n1):U:=array(1..n1):U1:=array(1..n1): %p A228629 for c from 1 to n1 do: %p A228629 U1[c]:=x1[c]:od:U:=sort(x1,`<`):V:=sort(x2,`>`): %p A228629 for j from 1 to n1 do: %p A228629 W[j]:= 9-V[j]:od:W1:=sort(W,`>`):jj:=0: %p A228629 for b from 1 to n1 do: %p A228629 if U[b]=W1[b] then %p A228629 jj:=jj+1: %p A228629 else fi: %p A228629 od: %p A228629 if jj=n1 then %p A228629 ii:=1: kk:=kk+1: printf(`%d, `,p1): %p A228629 else %p A228629 fi: %p A228629 fi: %p A228629 od: %p A228629 od: %p A228629 # Alternative: %p A228629 R:= 2,7: %p A228629 for d from 2 to 3 do %p A228629 P:= select(isprime,[seq(i,i=10^(d-1)+1..10^d-1,2)]); %p A228629 nP:= nops(P); %p A228629 Pd:= map(sort@convert,P,base,10); %p A228629 Ps:= convert(map(t -> ListTools:-Reverse([9$d]-t), Pd),set); %p A228629 S:= select(t -> member(Pd[t],Ps),[$1..nP]); %p A228629 R:= R, op(P[S]); %p A228629 od: %p A228629 R; # _Robert Israel_, Oct 06 2020 %Y A228629 Cf. A228628. %K A228629 nonn,base %O A228629 1,1 %A A228629 _Michel Lagneau_, Aug 28 2013