Find all triples (x, y, z) of positive integers such that
x³ + y³ + z³ - 3xyz = p
where p is a prime greater than 3
5 open "algeprm.txt" for output as #2
10 for Tot=3 to 500
20 for X=1 to int(Tot//3)
30 for Y=X to int((Tot-X)//2)
40 Z=Tot-X-Y
50 P=X^3+Y^3+Z^3-3*X*Y*Z
60 if fnPrime(P) then
70 :print X;Y;Z,P
71 :print #2,X;Y;Z,P
80 next
90 next
100 next
150 close
800 end
900 '
10000 fnOddfact(N)
10010 local K=0,P
10030 while N@2=0
10040 N=N\2
10050 K=K+1
10060 wend
10070 P=pack(N,K)
10080 return(P)
10090 '
10100 fnPrime(N)
10110 local I,X,J,Y,Q,K,T,Ans
10120 if N@2=0 then Ans=0:goto *EndPrime
10125 O=fnOddfact(N-1)
10130 Q=member(O,1)
10140 K=member(O,2)
10150 I=0
10160 repeat
10170 repeat
10180 X=fnLrand(N)
10190 until X>1
10200 J=0
10210 Y=modpow(X,Q,N)
10220 loop
10230 if or{and{J=0,Y=1},Y=N-1} then goto *ProbPrime
10240 if and{J>0,Y=1} then goto *NotPrime
10250 J=J+1
10260 if J=K then goto *NotPrime
10270 Y=(Y*Y)@N
10280 endloop
10290 *ProbPrime
10300 I=I+1
10310 until I>50
10320 Ans=1
10330 goto *EndPrime
10340 *NotPrime
10350 Ans=0
10360 *EndPrime
10370 return(Ans)
10380 '
10400 fnLrand(N)
10410 local R
10415 N=int(N)
10420 R=(int(rnd*10^(alen(N)+2)))@N
10430 return(R)
10440 '
10500 fnNxprime(X)
10510 if X@2=0 then X=X+1
10520 while fnPrime(X)=0
10530 X=X+2
10540 wend
10550 return(X)
10560 '
There seems to be a pattern: you can get any prime you want by making two of the numbers the same, and one differing by 1. The numbers themselves then also add up to the prime.
1 2 2 5
2 2 3 7
3 4 4 11
4 4 5 13
5 6 6 17
6 6 7 19
7 8 8 23
9 10 10 29
10 10 11 31
12 12 13 37
13 14 14 41
14 14 15 43
15 16 16 47
17 18 18 53
19 20 20 59
20 20 21 61
22 22 23 67
23 24 24 71
24 24 25 73
26 26 27 79
27 28 28 83
29 30 30 89
32 32 33 97
33 34 34 101
34 34 35 103
35 36 36 107
36 36 37 109
37 38 38 113
42 42 43 127
43 44 44 131
45 46 46 137
46 46 47 139
49 50 50 149
50 50 51 151
52 52 53 157
54 54 55 163
55 56 56 167
57 58 58 173
59 60 60 179
60 60 61 181
63 64 64 191
64 64 65 193
65 66 66 197
66 66 67 199
70 70 71 211
74 74 75 223
75 76 76 227
76 76 77 229
77 78 78 233
79 80 80 239
80 80 81 241
83 84 84 251
85 86 86 257
87 88 88 263
89 90 90 269
90 90 91 271
92 92 93 277
93 94 94 281
94 94 95 283
97 98 98 293
102 102 103 307
103 104 104 311
104 104 105 313
105 106 106 317
110 110 111 331
112 112 113 337
115 116 116 347
116 116 117 349
117 118 118 353
119 120 120 359
122 122 123 367
124 124 125 373
126 126 127 379
127 128 128 383
129 130 130 389
132 132 133 397
133 134 134 401
136 136 137 409
139 140 140 419
140 140 141 421
143 144 144 431
144 144 145 433
146 146 147 439
147 148 148 443
149 150 150 449
152 152 153 457
153 154 154 461
154 154 155 463
155 156 156 467
159 160 160 479
162 162 163 487
163 164 164 491
166 166 167 499
|
Posted by Charlie
on 2013-12-25 12:22:06 |