Problem 144 of Project Euler is once again a geometry problem, just like the previous. However, it is completely different. The problem readsIn laser physics, a "white cell" is a mirror system that acts as a delay line for the laser beam. The beam enters the cell, bounces around on the mirrors, and eventually works its way back out.The specific white cell we will be considering is an ellipse with the equation 4x2 + y2 = 100The section corresponding to -0.01 ≤ x ≤ +0.01 at the top is missing, allowing the light to enter and exit through the hole.The light beam in this problem starts at the point (0.0,10.1) just outside the white cell, and the beam first impacts the mirror at (1.4,-9.6).How many times does the beam hit the internal surface of the white cell before exiting?We will simply brute force our way through this problem, by calculating the laser beams path through the cell, and check if it hits the exit. In order to do that, we need to calculate how the laserbeam reflects. Once we know the angle of the reflecting beam, we can calculate the corresponding line, since we have the point of reflection. Once we have a line parameterization of the reflecting line, it is simply a matter of finding out where the line and the ellipse intersect. This will be the next point out laser beam hits. Confused yet? Don't be. I will elaborate on it. Lets start by finding the slope of the reflecting beam.

Continue reading...Saturday, April 6, 2013

Problem 143 of Project Euler is a notorious problem. Notorious for having the fewest correct answers per time it has been released. If you sort by number of solvers, you will see a pretty good correlation between problem number and place on that list. However, this problem is moved quite a bit down that list. The problem readsLet ABC be a triangle with all interior angles being less than 120 degrees. Let X be any point inside the triangle and let XA = p, XB = q, and XC = r.If the sum is minimised and a, b, c, p, q and r are all positive integers we shall call triangle ABC a Torricelli triangle. For example, a = 399, b = 455, c = 511 is an example of a Torricelli triangle, with p + q + r = 784.Find the sum of all distinct values of p + q + r ≤ 120000 for Torricelli triangles.After solving it, I can see why there are so few other people who have solved it. Because it was really difficult, and took a whole lot of research for me.

Continue reading...Saturday, December 8, 2012

Problem 126 of Project Euler is a really awesome geometric challenge. It readsWe shall define C(n) to represent the number of cuboids that contain n cubes in one of its layers. So C(22) = 2, C(46) = 4, C(78) = 5, and C(118) = 8.It turns out that 154 is the least value of n for which C(n) = 10.Find the least value of n for which C(n) = 1000.The first thing we should do is to figure out if we can deduce a formula to calculate the number of cubes needed to cover the previous layer.

Continue reading...Saturday, June 23, 2012

Problem 102 of Project Euler asks us the following questionfind the number of triangles in the text file for which the interior contains the origin.This problem can be solved in a plethora of ways as far as I have seen. I like one particular solution though, which involves calculating the area of triangle and compare it to triangles containing the point P which we are testing if it is in the interior of the triangle.

Continue reading...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...Saturday, March 3, 2012

Problem 86 of Project Euler is more of a geometric problem than most of what I have seen here. It requires one insight and then it is fairly straight forward to solve. An insight I am just about to give you, but let's start with the problem formulationThere are up to three "shortest" path candidates for any given cuboid and the shortest route is not always integer.By considering all cuboid rooms with integer dimensions, up to a maximum size of M by M by M, Find the least value of M such that the number of solutions first exceeds one million.The insight we need in order to proceed is how to calculate the shortest path. Once we figure that out the rest should be pretty forward.

Continue reading...Saturday, February 25, 2012

And now for something completely different.. or maybe as we will see later Problem 85 of Project Euler offers us a new problem where we can use the same ideas as for the solution to a previous problem. To lets start out with the problem text: Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution. A nice and short problem text. I have found two possible solutions for the problem, one using brute force and the other applying some combinatorics to find an analytical solution to the number of rectangles that we have for a given size.

Continue reading...Wednesday, May 4, 2011

At work I use many fairly advanced tools that can do a lot of things such as Matlab, which in all it’s glory is a very nice tool. However, for things such as Project Euler which does contain small problems, where I try to get a feeling for the problem in a whole other sense […]

Continue reading...This site uses cookies.

Saturday, April 13, 2013

12 Comments