# Project Euler Solutions

## Project Euler – Problem 83 Solution

The problem description is here, and click here to see all my other Euler solutions in F#.   This is a more difficult version of problem 82, and now you can move in all four directions! As before, we start by loading the input data into a 2D array: and initialize another matrix of the same …

## Project Euler – Problem 82 Solution

The problem description is here, and click here to see all my other Euler solutions in F#.   This is a more difficult version of problem 81, but still, as you can’t move left so we can still optimize one column at a time. First, let’s read the input file into a 2D array: and …

## Project Euler – Problem 102 Solution

The problem description is here, and click here to see all my other Euler solutions in F#.   After reading the question, a quick search on how to test if a point is in a triangle turned up this useful SO answer. Translating the algorithm to F# is pretty trivial: I saved the triangle.txt file …

## Project Euler – Problem 75 Solution

The problem description is here, and click here to see all my other Euler solutions in F#.   I based my solution on Euclid’s formula for generating Pythagorean triples. And given that max L is 1,500,000, the maximum value for m we need to consider is . Because and , we can deduce that ; and since we …

## Project Euler – Problem 68 Solution

Problem Consider the following “magic” 3-gon ring, filled with the numbers 1 to 6, and each line adding to nine. Working clockwise, and starting from the group of three with the numerically lowest external node (4,3,2 in this example), each solution can be described uniquely. For example, the above solution can be described by the …

## Project Euler – Problem 64 Solution

Problem All square roots are periodic when written as continued fractions and can be written in the form: For example, let us consider ?23: If we continue we would get the following expansion: The process can be summarised as follows: It can be seen that the sequence is repeating. For conciseness, we use the notation …

## Project Euler – Problem 80 Solution

Problem It is well known that if the square root of a natural number is not an integer, then it is irrational. The decimal expansion of such square roots is infinite without any repeating pattern at all. The square root of two is 1.41421356237309504880…, and the digital sum of the first one hundred decimal digits …

## Project Euler – Problem 61 Solution

Problem Triangle, square, pentagonal, hexagonal, heptagonal, and octagonal numbers are all figurate (polygonal) numbers and are generated by the following formulae: The ordered set of three 4-digit numbers: 8128, 2882, 8281, has three interesting properties. The set is cyclic, in that the last two digits of each number is the first two digits of the …

## Project Euler – Problem 65 Solution

Problem The square root of 2 can be written as an infinite continued fraction. The infinite continued fraction can be written, ?2 = [1;(2)], (2) indicates that 2 repeats ad infinitum. In a similar way, ?23 = [4;(1,3,1,8)]. It turns out that the sequence of partial values of continued fractions for square roots provide the …

## Project Euler – Problem 71 Solution

Problem Consider the fraction, n/d, where n and d are positive integers. If n < d and HCF(n,d)=1, it is called a reduced proper fraction. If we list the set of reduced proper fractions for d <= 8 in ascending order of size, we get: 1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, …