38 + 55 = 93 (2*19 + 5*11 = 3*31)
58 + 35 = 93 (2*29 + 5*7 = 3*31)
5 dim Cmp(40)
10 loop
20 P1=nxtprm(P1)
25 P2=P1
28 loop
30 P2=nxtprm(P2)
40 if P1*P2>9 and P1*P2<100 then print P1*P2
45 :inc Cct:Cmp(Cct)=P1*P2
100 if P1*P2>100 then goto *Leaveinner
110 endloop
120 *Leaveinner
130 if P1>100 then goto *Leaveouter
140 endloop
150 *Leaveouter
160 print Cct
200 for I=1 to Cct-1
210 for J=I+1 to Cct
220 T=Cmp(I)+Cmp(J)
230 if T<100 then
240 :for K=1 to Cct
250 :if K<>I and K<>J then
260 :if Cmp(K)=T then gosub 1000
270 :endif
280 :next
290 next
300 next
999 end
1000 A=prmdiv(Cmp(I)):B=Cmp(I)/A
1005 C=prmdiv(Cmp(J)):D=Cmp(J)/C
1010 E=prmdiv(T):F=T/E
1020 if A<>B and A<>C and A<>D and A<>E and A<>F then
1030 :if B<>C and B<>D and B<>E and B<>F then
1040 :if C<>D and C<>E and C<>F then
1050 :if D<>E and D<>F and E<>F then
1060 :C1=Cmp(I):C2=Cmp(J):C1h=C1
1070 :C1=10*(C1\10)+C2@10
1071 :C2=10*(C2\10)+C1h@10
1080 :A=prmdiv(C1):B=int(C1/A)
1085 :C=prmdiv(C2):D=int(C2/C)
1090 :if B>1 and prmdiv(B)=B and D>1 and prmdiv(D)=D then
1120 :if A<>B and A<>C and A<>D and A<>E and A<>F then
1130 :if B<>C and B<>D and B<>E and B<>F then
1140 :if C<>D and C<>E and C<>F then
1150 :if D<>E and D<>F and E<>F then
1990 :print Cmp(I);Cmp(J),T
2000 return
The 2-digit products of two primes:
10
14
22
26
34
38
46
58
62
74
82
86
94
15
21
33
39
51
57
69
87
93
35
55
65
85
95
77
91
29
The pairs that add to another while their swapped-digit versions are also members:
34 35 69
38 39 77
38 55 93
58 35 93
39 35 74
Only for the two pairs that add to 93 does the interchange make different numbers.
From Enigma No. 1538, "Six factors", by Richard England, New Scientist, 28 March 2009. |