P5722 link reply
Rtriangle.svg
One side of a right-angled triangle is 48. Find ten pairs of whole numbers which may represent the other two sides.
P5724 pyfaggotry theorem link reply
10 and 49
14 and 50
20 and 52
27 and 55
36 and 60
55 and 73
64 and 80
90 and 102
100 and 111
111 and 121
P5725 link reply
P5724
>>> [a**2 + b**2 == c**2 for a, b, c in [sorted([int(w) for w in l.split(' and ')] + [48]) for l in s.split('\n')]]
[False, True, True, False, True, True, True, True, False, False]
P5735 py*****ean faggotrem cont. link reply
P5724
140 and 148
189 and 195
286 and 290
575 and 577
P5738 link reply
So, we want a and b integers, so that 48²=a²±b². I could easily write a program that loops over a and b to find each value that works, but are there optimizations that could be made?

Let's take N=48
For one, a and b have the same parity (if N even), or opposite parities (if N odd), so we only need to test half the pairs
Where N²=a²+b², (N is the hypotenuse) we only need a≤b≤N (we'll get the same values for b≤a≤N).

Where N²=a²-b², (a is the hypotenuse) we only need a-N≤b<a and a≥N. One fact that is less obvious is that we only have to test for [tex: a\le \frac{N^2+1}{2}]
Proof: Let's assume that there exist an integer [tex: a > \frac{N^2+1}{2}] such that there exist an integer b<a verifying N²=a²-b². Then, N²<2a-1 => N²<a²-(a-1)² => b>a-1 => b≥a.
Since b<a and b≥a cannot both be verified, there is no integer [tex: a > \frac{N^2+1}{2}] such that there exist an integer b<a verifying N²=a²-b².

With all that said, the pairs of whole numbers that satisfy 48²=a²±b² are only ten:
50, 14
52, 20
60, 36
73, 55
80, 64
102, 90
148, 140
195, 189
290, 286
577, 575

Attached is the program that computed these
P5742 link reply
P5738
>Attached is the program that computed these
How do I run it?
P5745 link reply
P5742
Name it foo.c and run
cc foo.c
./a.out

I am so glad I got sniped, I don't have optimized implementations of Euclid's method of finding pytriples for one given side length on the brain. What I was doing sucked.

> [tex: \exists] only ten, eh. What's the proof of that?
P5757 link reply
P5745
I didn't exactly prove that there were only ten, I proved that there were no pair with a>1152, and I tried every value until that point
P5759 link reply
Hypothesis: when N is even, [tex: \left(\left\lfloor\frac{N^2+5}{4}\right\rfloor , \lfloor\frac{N^2-3}{4}\right\rfloor \right)] is a solution. When N is odd, [tex: \left(\left\lfloor\frac{N^2+1}{2}\right\rfloor , \lfloor\frac{N^2-1}{2}\right\rfloor \right)] is a solution.
Can you prove this or find a counter-example?
P5760 link reply
P5759
Oh, this doesn't support large parentheses.
> Hypothesis: when N is even, [tex: (\lfloor\fracc{N^2+5}{4}\rfloor , \lfloor\frac{N^2-3}{4}\rfloor )] is a solution.
> When N is odd, [tex: (\lfloor\frac{N^2+1}{2}\rfloor , \lfloor\frac{N^2-1}{2}\rfloor)] is a solution.
> Can you prove this or find a counter-example?
P5761 link reply
P5759
P5760
***** it, you get the idea.
I forgot to precise, this is for N≥3
P5778 link reply
P5760
You can drop the floor function by changing it to
> Hypothesis: when N is even, [tex: (\fracc{N^2}{4}+1 , \frac{N^2}{4}-1 )] is a solution.
> When N is odd, [tex: (\frac{N^2+1}{2} , \frac{N^2-1}{2})] is a solution.

which is easy to verify algebraically.
P5779 link reply
P5778
> Hypothesis: when N is even, [tex: (\frac{N^2}{4}+1 , \frac{N^2}{4}-1 )] is a solution.
> When N is odd, [tex: (\frac{N^2+1}{2} , \frac{N^2-1}{2})] is a solution.
x