Find all the pairs of positive numbers such that the last
digit of their sum is 3, their difference is a prime number and
their product is a perfect square.
p=1; diff=0;
while diff<10000
diff=nextprime(diff+1);
for s=3:10:100000
n1=(s-diff)/2;
if n1==floor(n1) && n1>0
n2=n1+diff;
prod=n1*n2;
sr=round(sqrt(prod));
if sr*sr==prod
disp([n1 n2 diff s prod sr])
end
end
end
end
finds only
n1 n2 diff sum prod square
root
4 9 5 13 36 6
Eliminating the need for the sum to end in 3 yields many other
results, all with the sum ending in either 1 or 5.
For example:
1 4 3 5 4 2
4 9 5 13 36 6 Our answer with terminal 3 in the sum
9 16 7 25 144 12
25 36 11 61 900 30
36 49 13 85 1764 42
64 81 17 145 5184 72
81 100 19 181 8100 90
121 144 23 265 17424 132
196 225 29 421 44100 210
225 256 31 481 57600 240
324 361 37 685 116964 342
400 441 41 841 176400 420
. . .
|
Posted by Charlie
on 2020-12-19 13:12:05 |