OFFSET
1,1
COMMENTS
The prime p in the pair (p, q) is not unique; for example, the prime 163 generates two pairs of primes: (163, 683) and (163, 863).
LINKS
Michel Lagneau, Table of (p, q) for 5000 pairs
EXAMPLE
(241, 587) and (241, 857) are in the sequence because the digits 5, 8, 7 are the 9's complement of the decimal digits of 241.
MAPLE
with(numtheory):
for n from 1 to 200 do:
p1:=ithprime(n)
for k from n+1 to 2000 do:
p2:=ithprime(k):
x1:=convert(p1, base, 10):n1:=nops(x1):
x2:=convert(p2, base, 10):n2:=nops(x2):
if n1=n2 then
W:=array(1..n1):U:=array(1..n1):U1:=array(1..n1):
for c from 1 to n1 do:
U1[c]:=x1[c]:od:U:=sort(x1, `<`):V:=sort(x2, `>`):
for j from 1 to n1 do:
W[j]:= 9-V[j]:od:W1:=sort(W, `>`):jj:=0:
for b from 1 to n1 do:
if U[b]=W1[b] then jj:=jj+1:
else
fi:
od:
if jj=n1 and p1<p2
then
printf(`%d, `, p1):
printf(`%d, `, p2):else
fi:
fi:
od:
od:
CROSSREFS
KEYWORD
nonn,base,less
AUTHOR
Michel Lagneau, Aug 29 2013
STATUS
approved