The first Project Euler problem - Multiples of 3 and 5 - is stated as follows. Find the sum of all the multiples of 3 or 5 below 1000.

```
% Create a range from 1 to 999.
range = [1:999];
% Find all values that are multiples of 3 and/or 5.
multiples = find(mod(range,3) == 0 | mod(range,5) == 0);
% Sum multiples and echo.
sum(multiples)
```

The third Project Euler problem - Largest Prime Factor - is stated as follows. What is the largest prime factor of the number 600851475143?

```
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static IEnumerable<long> Primes()
{
// Create a range between 2 and the closest we can get Infinity.
return Enumerable.Range(2, Int32.MaxValue - 1)
// Get all values which are only divisible by themself and 1.
.Where(x => Enumerable.Range(2, x-2).All(y => x % y != 0))
// Cast the values to long.
.Select(n => (long)n);
}
public static IEnumerable<long> PrimeFactors(long input)
{
// Get all primes...
long next = Primes()
// ... below the square root of input.
.TakeWhile(x => x <= Math.Sqrt(input))
// Find the first prime that input is divisble by.
.FirstOrDefault(x => input % x == 0);
if(next == default(long)){
// If we can't find a new factor, then input is the last factor.
return new long[]{input};
} else {
// Add the found factor to the list and recurse.
return new long[]{next}.Concat(PrimeFactors(input / next));
}
}
public static void Main()
{
long factor = PrimeFactors(600851475143).Max();
Console.WriteLine(factor);
}
}
```

The second Project Euler problem - Even Fibonacci Numbers - is stated as follows - By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

```
using System;
using System.Linq;
public class Program
{
// Returns true if if N is a perfect square,
// i.e. N can be expressed as the product
// of two equal integers.
static bool isPerfectSquare(long x)
{
long s = (long)Math.Sqrt(x);
return (s * s == x);
}
// Returns true if N is in the Fibonacci sequence.
static bool isFibonacci(long n)
{
// M is Fibonacci if and only if one or both of
// 5*n*n + 4 or 5*n*n - 4 is a perfect square.
// https://en.wikipedia.org/wiki/Fibonacci_number#Recognizing_Fibonacci_numbers
return isPerfectSquare(5 * n * n + 4) || isPerfectSquare(5 * n * n - 4);
}
// Returns true if N is even.
static bool isEven(int n)
{
return n % 2 == 0;
}
public static void Main()
{
// Generate a range from 1 to 4 million.
long sum = Enumerable.Range(1, 4000000)
// Take only fibonacci numbers...
.Where(n => isFibonacci((long)n))
// ...that are even.
.Where(isEven)
.Sum();
Console.WriteLine(sum);
}
}
```

The first Project Euler problem - Multiples of 3 and 5 - is stated as follows. Find the sum of all the multiples of 3 or 5 below 1000.

```
using System;
using System.Linq;
public class Program
{
public static void Main()
{
long sum = Enumerable.Range(1, 999)
.Where(n => (n % 3 == 0 || n % 5 == 0))
.Sum();
Console.WriteLine(sum);
}
}
```

The second Project Euler problem - Even Fibonacci Numbers - is stated as follows - By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

```
// Generate a sequence thar produces the Fibonacci numbers.
// Fn = Fn-1 + Fn-2
let sequence = Seq.unfold (fun (a,b) -> Some( a+b, (b, a+b) ) ) (0,1)
let sum =
sequence
// Keep even numbers.
|> Seq.filter (fun n -> n % 2 = 0)
// Only take the values below four million.
|> Seq.takeWhile (fun n -> n < 4000000)
// Return the sum of the elements in the sequence.
|> Seq.sum
printfn "%i" sum
```

- Project Euler 1 - Multiples of 3 or 5 - Solved with C#
- Project Euler 2 - Even Fibonacci Numbers - Solved with F#
- Project Euler 1 - Multiples of 3 or 5 - Solved with F#
- RoboRackersâ„˘ - Riddle by FiveThirtyEight - Solved with Javacript
- Project Euler Problem 17 - Number Letter Counts - solved with R
- Project Euler Problem 16 - Power Digit Sum - solved with Javascript
- Project Euler Problem 15 - Lattice Paths - solved with R
- Finding the 10001st prime with R
- Find longest Collatz sequence using Javascript
- Sum large numbers with Kotlin versus Javascript
- What is a binary tree and how to invert it using Kotlin
- Find Highly Divisible Triangular Numbers with Kotlin
- Find the Largest Product in a Grid with Rust
- Summation of the First Two Million Primes with Rust
- Finding the largest product in a series with Rust
- Finding the 10001st prime with Rust
- The complete list of rational numbers with Stern-Brocot and Javascript
- Smallest positive number that is evenly divisible by all of the numbers from 1 to 20 with Rust
- Find the difference between the square of the sum and the sum of the squares for the first hundred numbers
- Finding the largest palindrome product with Rust
- Project Euler 3 - Largest Prime Factor - Solved with Reason
- Project Euler 2 - Even Fibonacci Numbers - Solved with Ocaml
- Project Euler 1 - Multiples of 3 or 5 - Solved with Ocaml
- Special Pythagorean Triplet solved with Reason
- New Year's Resolution 2018