A Pythagorean triplet is a set of three natural numbers, a < b < c, for which

A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,

a2 + b2 = c2
For example, 32 + 42 = 9 + 16 = 25 = 52.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.

Attached: 442c5fe2a28d26ff64d168be98233c6c.jpg (1600x1067, 113K)

Other urls found in this thread:

mathsisfun.com/pythagorean_triples.html
twitter.com/SFWRedditImages

get that nerd trash outta here, we only talk about consumer hardware

Do your own programming homework, kid.

Square root of 1000 divided by 0.666...

Just a guess, didn't really attempt the problem

a < b < c tard

>32 + 42 = 9 + 16 = 25 = 52
wat

#include
int main() {
int a, b, c, x = 1000; //one Pythagorean triplet for which a + b + c = 1000.
for (a = 1; a < x; a++) { //a < b < c
for (b = a; b < x / 2; b++) {
c = x - a - b;
if (a * a + b * b == c * c) { //a^2+b^2=c^2
std::cout

50 + 450 + 500 = 1000
50 < 450 < 500
owo?

Just brute Force it, what is the point?

a=3*sqrt20
b=4*sqrt20
c=5*sqrt20

What is a natural number?

so abc is 5366,56

Function x^2+y^2=1 has a maximum value of x+y for x=y=sqrt(2)/2
Assume a=b:
B=c/sqrt2
b+b+c=1000
C(1+sqrt(2))=1000
C=1000/(1+sqrt(2)) -> this is the minimum value for c.

Take c=1000/(1+sqrt(2)), round it to the lower integer. Let a=b=(1000-c)/2 (or if c is odd, let b=a+1).
While a^2+b^2 is greater than c^2, increment b and decrement a.
If a^2+b^2 is now lesser than c^2, increment c, and repeat the procedure.

Not cute enough to get me to do your homework.

You don't even need to write a program to do this. I've done a lot of Project Euler problems by hand. Then again I'm more of a mathfag than a programmer.

200,300,500

Just use Euclid's formula to simplify the problem.

375, 200, 425.

Found the solution with pen & paper using Euler's formula to simplify the problem.

*Euclid's formula.

So abc = 31875000

OPs explanation is interesting.
Here is a better explanation mathsisfun.com/pythagorean_triples.html guys.

Too lazy for pen&paper, here's a lisp solution:
(for [a (range 1 1000)
b (range 1 a)
c (range 1 b)
:when (and (= (+ (* b b) (* c c)) (* a a))
(= 1000 (+ a b c)))]
[a b c])
user=> ([425 375 200])

> inb4 clojure is not a real lisp
ftfy

This is project Euler problem #9, newfags.

Must also satisfy a^2 + b^2 = c^2

Clojure is great.

Underrated

>For example, 32 + 42 = 9 + 16 = 25 = 52.
just what the fuck am I reading?
is this some kind of common core bullshit?

He just copypasta'd it from the Project Euler website, thus losing the superscript. It reads 3^2 + 4^2 = 9 + 16 = 25 = 5^2

Attached: Screenshot_2018-12-04_15-46-37.png (580x283, 28K)

that makes sense
thank you for bringing back my sanity, user

>32 + 42 = 9 + 16

You're retarded2.

Pythagorean triplets are guaranteed to be a:b:c == 3:4:5
In that case:
3x+4x+5x = 1000
You can figure out the rest on your own, also sage.

200^2 + 375^ == 425^2
200+375+425 == 1000

>exactly one
I must be retarded because I found two.

There are a lot more than just one faggot
This

3x+4x+5x = 1000
12x = 1000
x = 1000/12
3*1000/12 = 1000/4 = 250
4*1000/12 = 1000/3 = 333.3333333333333333
5*1000/12 = 1250/3 = 416.6666666666666667
>A Pythagorean triplet is a set of three natural numbers, a < b < c, for which...
>natural numbers

>all pythagorean triplets are multiples of 3:4:5

my fucking sides

9,40,41

This is what you get for not majoring in math. Brainlet

Fuck off. Project Euler is meant to be an individual attempt. By having other people solve the problem for you, you go against the nature of the project.

Literally just write the constraints in prolog and let it do it for you

>32 + 42 = 9 + 16
> 25 = 52.
wut?

I think 32, 42, 52 are supposed to be 3^2, 4^2, 5^2.
OP was just too dumb to copy properly from projecteuler.

Threads like these just reaffirm my belief that most programmers are literal retards.

for m in range(1000):
for n in range(1000):
a = m**2 - n**2
b = 2 * m * n
c = m ** 2 + n**2
if a + b + c == 1000:
if a > 0 and b > 0 and c > 0:
return (a, b, c) #not ordered, need ordering or just switch a,b,c


>> res: (200, 375, 425)

but thats wrong, i can think of 997x997x997 different ways for a+b+c = 1000

for a in range(1,1000):
for b in range(a,1000):
c = 1000-a-b
if a*a+b*b==c*c:
print(a*b*c)

Should not a be a constant?

I wish she didn't retire from JAV. Literally god tier especially her non-censored stuff.

what does this nerd shit have to do with graphics cards?

What do porn actress even do after retiring?

probably kill themselves

Three kinds of solutions:

Patrician:
Use pen & paper with Euclid's formula, find that this is equivalent to m and (m+n) dividing 500, find the small number of divisor combinations of 500 by hand.

Acceptable:
Quadratic algorithm like in
Plebian:
Unoptimized cubic algorithm like in , regardless of whether or not a list comprehension is "elegant" or not. But acceptable as a naive solution.

Come see me after class:
for applying Euclid's formula without understanding it, assuming that the triple must be a primitive one, and finding the non-primitive triple out of pure dumb luck with non-coprime m,n. For values other than 1000 this can give incorrect results.

Who is she? I wanna cum to her pornos.

wrong board retard

hmmmm
so we have

1. a^2 + b^2 = c^2
2. a + b + c = 1000
3. c > b > a
4. a,b,c in N

So you are looking for a right triangle whose perimeter is 1000?

a + b + c = 1000 you absolute brainlet

I was expecting a bit of a challenge but I can solve it with paper and pen
disappointed

Ai Uehara

for a in range(1,50):
if((1000*(a-500))%(a-1000)):
b=(1000*(a-500))/(a-1000)
c=(a**2)+(b**2)
return a,b,c

Problem said:
>> Find the product abc.

Thanks, I jerked off to one of them. She’s alright.

Easy, triples can be written as

(a,b,c) = ( m^2 - n^2, 2 m n , m^2 + n^2)

then

a + b + c = 1000
=> 2 m^2 + 2 m n = 1000
=> m^2 + m n = 500

m ( m + n) = 25 * 20

so m = 20, n = 5 is a solution.

This gives

(a,b,c) = (375, 200, 425)

fake news

>Pythagorean triplets are guaranteed to be a:b:c == 3:4:5
lol

kek

Don’t trust Jow Forums with math.