Talk:Special pythagorean triplet: Difference between revisions
no edit summary
m (last guess) |
No edit summary |
||
Line 1:
For those paying "attention to timings" and more importantly for those paying attention to other comments I have made on these Euler tasks about filling RC with solutions worse than I would expect from a schoolboy with a pencil, considering n<sup>2</sup>+g<sup>2</sup>=i<sup>2</sup> and n+g+i=
the largest value n can take is 332 with g=333 and i=335
the smallest value of i<sup>2</sup>-g<sup>2</sup> is when g=(
if i<sup>2</sup>-g<sup>2</sup> is greater than n<sup>2</sup> then there can be no solution for this n with a smaller g
if z-n
if z-n is odd then:
2(g+i)+1 must be a factor of n<sup>2</sup>
given these conditions the solution is n, ((g+i)/2)-n<sup>2</sup>/(2(g+i)+1), ((g+i)/2)+n<sup>2</sup>/(2(g+i)+1) asserting that n<g.
--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 14:11, 31 August 2021 (UTC)
Isn't the task to print out abc?
Also, isn't using Euclid's formula (as in the XPL0 solution) going to be faster - less values to try ? --[[User:Tigerofdarkness|Tigerofdarkness]] ([[User talk:Tigerofdarkness|talk]]) 17:34, 31 August 2021 (UTC)
:Given the rules above it is necessary to check
The task description says there is only one triple with a + b + c = 1000, so it must be a primitive one. --[[User:Tigerofdarkness|Tigerofdarkness]] ([[User talk:Tigerofdarkness|talk]]) 18:14, 31 August 2021 (UTC)
I have added three observations to the list above which remove the requirement for searching which I think may need explanation. For a given n when n-z is even identify a value g such that n+(g-1)+(g+1)=1000 (eg 3,498,499). The problem may be rewritten as n<sup>2</sup>=(g+x)<sup>2</sup>-(g-x)<sup>2</sup>. (g+x)<sup>2</sup>-(g-x)<sup>2</sup> is 4xg. Therefore 4g must be a factor of n<sup>2</sup>
|