Posts Tagged with "Pythagoras"

Project Euler 94: Investigating almost equilateral triangles with integral sides and area.

Saturday, April 28, 2012


I can realy feel that the problems become harder and harder. Problem 94 of Project Euler took me a good while to figure out. The problem is easy to understand and readsWe shall define an almost equilateral triangle to be a triangle for which two sides are equal and the third differs by no more than one unit.Find the sum of the perimeters of all almost equilateral triangles with integral side lengths and area and whose perimeters do not exceed one billion (1,000,000,000).We are dealing with a triangle with two sides of length a and one side of length b = a-1 or b = a+1. I will treat these as two different cases for the next paragraf or two.

Continue reading...

Project Euler 91: Find the number of right angle triangles in the quadrant

Saturday, April 7, 2012

1 Comment

In Problem 91 of Project Euler we are dealing with a geometry problem which readsGiven that 0 ≤ x1, y1, x2, y2  50, how many right triangles can be formed?The brute force solution for solving this would be to test all combinations of P and Q which is along the lines of 514 which is approximately 7.000.000 solutions to check. So we will take another approach here.There are three possibilities to make a right angled triangle. Either the right angle is at O, P and Q. O is fixed but P and Q can be interchanged so we will start by treating the regular case of the right angle being at P and 0 < x1, y1. You will see later on that the other cases are special cases which we can solve rather easily.

Continue reading...
Project Euler 75: Find the number of different lengths of wire that can form a right angle triangle in only one way.

Project Euler 75: Find the number of different lengths of wire that can form a right angle triangle in only one way.

Saturday, December 17, 2011


Assuming we have solved the problems from one end, we are now at Problem 75 of Project Euler which should unlock the 75 problem achievement as well as the Pythagorean Triplet achievement. The problem description readsGiven that L is the length of the wire, for how many values of L ≤ 1,500,000 can exactly one integer sided right angle triangle be formed?I have already noted that we should unlock the Pythagorean triplet achievement, and that is for a reason. In order to get a good solution we need to revisit the theory we used in Problem 9 about Pythagorean triples.

Continue reading...

Project Euler 39: If p is the perimeter of a right angle triangle, {a, b, c}, which value, for p ≤ 1000, has the most solutions?

Tuesday, May 3, 2011


Even though the title nor the description of Problem 39 of Project Euler mentions Pythagorean Triplets, this is the topic we are revisiting. The problem description readsIf p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120.{20,48,52}, {24,45,51}, {30,40,50}For which value of p ≤ 1000, is the number of solutions maximised?The answer is certainly not p = 1000 which I can state so boldly since we in Problem 9 was given the fact that there only exists 1 triplet with that property.I have found three different approaches to solving this problem. We can brute force it, we can take an arithmetic approach where we rewrite the equations so we only have to work two parameters and check if an equation has an integer solution, and last but not least we can reuse all the work we derived in solving Problem 9 yielding a very efficient solution to the problem.

Continue reading...

A 1000 Pythagorean triplets – Problem 9

Monday, November 15, 2010


Problem 9 of Project Euler states A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2There exists exactly one Pythagorean triplet for which a + b + c = 1000.Find the product abc.Problem 9 of Project Euler has a widely used brute force approach, which is common on other blogs. Read my blog post to find a detailed explanation to a number theoretical approach as well.

Continue reading...
This site uses cookies.