-
Project Euler – Problem # 12 – Solved with Java
What is the value of the first triangle number to have over five hundred divisors? The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:…
-
Project Euler – Problem # 11 – Solved with Java
What is the greatest product of four adjacent numbers on the same straight line in the 20 by 20 grid? In the 2020 grid below, four numbers along a diagonal line have been marked in red. 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91…
-
Project Euler – Problem # 10 – Solved with Java & Python
Calculate the sum of all the primes below two million. The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. One Possible Solution: Java This file contains bidirectional Unicode text that may be interpreted or compiled differently than…
-
Project Euler – Problem # 9 – Solved with Java & Python
Find the only Pythagorean triplet, {a, b, c}, for which a + b + c = 1000. 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…
-
Project Euler – Problem # 7 – Solved with Java & Python
Find the 10001st prime. By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? One Possible Solution: Java One Possible Solution: Python
-
Project Euler – Problem # 6 – Solved with Java & Python
What is the difference between the sum of the squares and the square of the sums? The sum of the squares of the first ten natural numbers is, 12 + 22 + … + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + … +…
-
Project Euler – Problem # 5 – Solved with Java & Python
What is the smallest number divisible by each of the numbers 1 to 20? 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? **********…
-
Project Euler – Problem # 4 – Solved with Java & Python
Find the largest palindrome made from the product of two 3-digit numbers. A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99. Find the largest palindrome made from the product of two 3-digit numbers. ********** The way to reverse a sting…
-
Project Euler – Problem # 3 – Solved with Java & Python
Find the largest prime factor of a composite number. The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? ********** The question is: “How many prime numbers do we need to try?” I used the square root of n 600851475143. That would be…
-
Project Euler – Problem # 2 – Solved with Java & Python
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, … By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the…