x^2-y^2 = y^2-z^2 = 5 is a classic problem that can be solved in the rationals, with, e.g.:
(49/12)2-(41/12)2 = (41/12)2-(31/12)2 = 5
(Fibonacci).
We seek non-trivial rational solutions to x^2-y^2 = y^2-z^2 = P, with P prime. Since we can always find compound multiples of such solutions with other primes happily joining the chain, let's call these paragons 'conga primes'. (Conversely, primes that only appear in conjunction with other primes could be 'tango primes', since it takes at least two...)
1. Solve over the rationals:
x^2-y^2 = y^2-z^2 = 7
x^2-y^2 = y^2-z^2 = 41
2. Give an example of a 'conga prime', P, greater than 41, such that x^2-y^2 = y^2-z^2 = P.
By not going after only one equation at a time, as Jer had started to do, rather than both equations simultaneously, the process is speeded up considerably. The following program produces a file of candidates, using just one equation:
DATA 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59
DATA 61,67,71,73,79,83,89,97,101,103,107,109,113
DEFDBL A-Z
CLS
OPEN "conga prime 2.txt" FOR OUTPUT AS #2
DIM prm(30)
FOR i = 1 TO 30: READ prm(i): NEXT
FOR tot = 3 TO 999999
FOR a = -INT(-tot / 2) TO tot - 1
b = tot - a
IF b < a THEN
b2 = b * b
diff = a * a - b * b
FOR p = 14 TO 30
q = diff / prm(p)
IF q = INT(q) THEN
sr = INT(SQR(q) + .5)
IF sr * sr = q THEN
IF gcd(gcd(a, b), sr) = 1 THEN
PRINT USING "#######"; a; b, sr, prm(p)
PRINT #2, USING "#######"; a; b, sr, prm(p)
END IF
END IF
END IF
NEXT
END IF
NEXT
NEXT tot
FUNCTION gcd (x, y)
dnd = x: dvr = y
IF dnd < dvr THEN SWAP dnd, dvr
DO
q = INT(dnd / dvr)
r = dnd - q * dvr
dnd = dvr: dvr = r
LOOP UNTIL r = 0
gcd = dnd
END FUNCTION
When the program was stopped after getting numbers over 100,000 and the output is formatted by another program we get over 8500 results for 43 alone and over 110,000 results for primes up to 113. Here's a sampling of a few:
(99437/15164)^2 - (21/15164)^2 = 43
(3482/531)^2 - (1/531)^2 = 43
(53771/8200)^2 - (21/8200)^2 = 43
(72322/11029)^2 - (39/11029)^2 = 43
(124093/18924)^2 - (91/18924)^2 = 43
(22033/3360)^2 - (17/3360)^2 = 43
(72263/11020)^2 - (63/11020)^2 = 43
(130198/19855)^2 - (123/19855)^2 = 43
(103142/15729)^2 - (101/15729)^2 = 43
(130939/19968)^2 - (133/19968)^2 = 43
(34361/5240)^2 - (39/5240)^2 = 43
(22774/3473)^2 - (27/3473)^2 = 43
(41266/6293)^2 - (57/6293)^2 = 43
(77509/11820)^2 - (109/11820)^2 = 43
(58958/8991)^2 - (91/8991)^2 = 43
(120598/18391)^2 - (189/18391)^2 = 43
(112034/17085)^2 - (191/17085)^2 = 43
(10387/1584)^2 - (19/1584)^2 = 43
(139418/21261)^2 - (289/21261)^2 = 43
(4223/644)^2 - (9/644)^2 = 43
(52558/8015)^2 - (117/8015)^2 = 43
(49417/7536)^2 - (119/7536)^2 = 43
(117431/17908)^2 - (303/17908)^2 = 43
(95234/14523)^2 - (247/14523)^2 = 43
(137969/21040)^2 - (369/21040)^2 = 43
(46958/7161)^2 - (131/7161)^2 = 43
(7246/1105)^2 - (21/1105)^2 = 43
(58309/8892)^2 - (173/8892)^2 = 43
(15574/2375)^2 - (51/2375)^2 = 43
(67201/10248)^2 - (223/10248)^2 = 43
(79234/12083)^2 - (273/12083)^2 = 43
(82939/12648)^2 - (293/12648)^2 = 43
(79798/12169)^2 - (291/12169)^2 = 43
(19279/2940)^2 - (71/2940)^2 = 43
(94618/14429)^2 - (369/14429)^2 = 43
(12433/1896)^2 - (49/1896)^2 = 43
(87713/13376)^2 - (351/13376)^2 = 43
(121294/18497)^2 - (507/18497)^2 = 43
(12374/1887)^2 - (53/1887)^2 = 43
(36322/5539)^2 - (159/5539)^2 = 43
(110953/16920)^2 - (503/16920)^2 = 43
(129478/19745)^2 - (597/19745)^2 = 43
(24971/3808)^2 - (117/3808)^2 = 43
(30899/4712)^2 - (147/4712)^2 = 43
(65726/10023)^2 - (323/10023)^2 = 43
(136921/20880)^2 - (679/20880)^2 = 43
However, using a program to match up fractions, no pairs of such equations were found sharing a fraction as specified in the puzzle.
The matchup was attempted by first expanding the records to include a decimal version of one of the fractions and then using another program to do a binary search looking for mathes on the sorted file:
DEFDBL A-Z
OPEN "congap.txt" FOR INPUT AS #1
OPEN "congap.txt" FOR BINARY AS #2
OPEN "congarst.txt" FOR OUTPUT AS #3
rec1$ = SPACE$(46)
rec2$ = rec1$
LINE INPUT #1, l$: pn = 1
DO
prm = VAL(MID$(l$, 22, 7))
prm0 = prm
strt = pn
WHILE prm = prm0 AND EOF(1) = 0
LINE INPUT #1, l$: pn = pn + 1
prm = VAL(MID$(l$, 22, 7))
WEND
fin = pn - 1
PRINT prm0, strt; fin
FOR n = strt TO fin
GET #2, (n - 1) * 46 + 1, rec1$
num = VAL(MID$(rec1$, 1, 7))
den = VAL(MID$(rec1$, 15, 7))
f = num / den
low = strt: high = fin
DO
mid = INT((low + high) / 2)
GET #2, (mid - 1) * 46 + 1, rec2$
f2 = VAL(MID$(rec2$, 29, 16))
IF f2 > f THEN high = mid - 1
IF f2 < f THEN low = mid + 1
LOOP UNTIL low >= high OR f2 = f
rat = f / f2
IF ABS(rat - 1) < .000000001# THEN
PRINT LEFT$(rec1$, 44): PRINT rec2$
PRINT #3, LEFT$(rec1$, 44): PRINT #3, rec2$
END IF
NEXT n
LOOP UNTIL EOF(1)
|
Posted by Charlie
on 2013-03-26 14:21:36 |