All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Complementary, my dear Watson (Posted on 2012-06-22)
A Digit Complementary Prime Pair is defined as a pair of prime numbers in which digits in corresponding positions sum to 0 mod 10, e.g. (4721, 6389).
Out of the 136 existing four digit pairs find at least one pair for each of the following requirements (a to f):
a. a reversible prime pair
b. the two primes contain 8 different digits
c. twin primes
d. both primes contain a permutation of 4 consecutive digits
e. first member of the pair contains the 4 prime digits in order
f. each prime contains 3 digits the same

Source: Charles W. Trigg, JRM 22:2, 1990, p 95-97

Bonus: Find a 50 digit DCPP, satisfying a).

 No Solution Yet Submitted by Ady TZIDON Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution | Comment 1 of 6

Of course the solution to part e is 2357 8753. The other parts are listed below, with the given part identified. The lower number is shown on the left in all cases.

1009  9001  a
1069  9041  a
1097  9013  a
1181  9929  f
1409  9601  a
1487  9623  b
1559  9551  a
1619  9491  a
1949  9161  a
2111  8999  f
2417  8693  b
2741  8369  b
2963  8147  b
2999  8111  f
3067  7043  a
3083  7027  a
3109  7901  a
3407  7603  a
3467  7643  a
3533  7577  f
3803  7207  a
3917  7193  a
4127  6983  b
4253  6857  d
4721  6389  b
5051  5059  c
5503  5507  c

Sorted by the applicable part:

1009  9001  a
1069  9041  a
1097  9013  a
1409  9601  a
1559  9551  a
1619  9491  a
1949  9161  a
3067  7043  a
3083  7027  a
3109  7901  a
3407  7603  a
3467  7643  a
3803  7207  a
3917  7193  a
1487  9623  b
2417  8693  b
2741  8369  b
2963  8147  b
4127  6983  b
4721  6389  b
5051  5059  c
5503  5507  c
4253  6857  d
1181  9929  f
2111  8999  f
2999  8111  f
3533  7577  f

If any had satisfied more than one part, that would have been shown, but no instances of this were found.

5   open "dcompprm.txt" for output as #2
10   P=999
20   dim Digpres(9)
30   while P<9999
40     P=nxtprm(P)
50     erase Digpres()
60     dim Digpres(9)
70     Ps=cutspc(str(P))
80     Cps="":Revs="":Revcs=""
90     Dup=0
100     for I=1 to len(Ps)
110       Digpres(val(mid(Ps,I,1)))=Digpres(val(mid(Ps,I,1)))+1
120       Cps=Cps+cutspc(str((10-val(mid(Ps,I,1)))@10))
130       Revs=mid(Ps,I,1)+Revs
140       Revcs=cutspc(str((10-val(mid(Ps,I,1)))@10))+Revcs
150     next
160     Consec=0:Triple=0
170     for I=3 to 9
180       if Digpres(I)>0 and Digpres(I-1)>0 and Digpres(I-2)>0 and Digpres(I-3)>0 then Consec=1
200     next
202     for I=0 to 9
203       if Digpres(I)=3 then Triple=1
204       if Digpres(I)>1 then Dup=1
205     next
210     Chk=Ps+Cps
220     for I=1 to len(Chk)-1
230      if instr(mid(Chk,I+1,*),mid(Chk,I,1))>0 then Dup=1
240     next
250     Cp=val(Cps)
260     Rev=val(Revs)
270     Revc=val(Revcs)
280     Anstyp=""
290     if prmdiv(Cp)=Cp then
300        :if prmdiv(Rev)=Rev and prmdiv(Revc)=Revc then
310          :Anstyp=Anstyp+"a"
320        :endif
330        :if Dup=0 then
340          :Anstyp=Anstyp+"b"
350        :endif
360        :if nxtprm(P)=Cp or nxtprm(Cp)=P then
370          :Anstyp=Anstyp+"c"
380        :endif
390        :if Consec then
400          :Anstyp=Anstyp+"d"
410        :endif
420        :if Triple then
430          :Anstyp=Anstyp+"f"
440        :endif
450        :if Anstyp>"" and P<Cp then print #2,P;Cp,Anstyp:endif
460     :endif
470   wend
480   close #2

 Posted by Charlie on 2012-06-22 14:41:30

 Search: Search body:
Forums (0)