Posts Tagged ‘ Project Euler ’

[Project Euler] – Problem 58

May 21, 2011
By
[Project Euler] – Problem 58

Starting with 1 and spiralling anticlockwise in the following way, a square spiral with side length 7 is formed.37 36 35 34 33 32 3138 17 16 15 14 13 30Read More: 597 Words Totally

Read more »

[Project Euler] – Problem 57

May 19, 2011
By

It is possible to show that the square root of two can be expressed as an infinite continued fraction.√ 2 = 1 + 1/(2 + 1/(2 + 1/(2 + … ))) = 1.414213…By expanding this for the first four iterations, we get:Read More: 547 Words Totally

Read more »

Project Euler — Problem 187

December 23, 2010
By

http://projecteuler.net/index.php?section=problems&id=187A composite is a number containing at least two prime factors. For example, 15 = 3 × 5; 9 = 3 × 3; 12 = 2 × 2 × 3.There are ten composites below thirty containing precisely two, not necessarily distinct, prime factors: 4, 6, 9, 10, 14, 15, 21, 22, 25, 26.Read...

Read more »

Project Euler — Problem 187

December 23, 2010
By

http://projecteuler.net/index.php?section=problems&id=187A composite is a number containing at least two prime factors. For example, 15 = 3 × 5; 9 = 3 × 3; 12 = 2 × 2 × 3.There are ten composites below thirty containing precisely two, not necessarily distinct, prime factors: 4, 6, 9, 10, 14, 15, 21, 22, 25, 26.Read...

Read more »

Project Euler Problem #21

August 16, 2010
By

This is a solution for problem 21 on the Project Euler website. It consists of finding the sum of all the amicable numbers under 10000. This was pretty easy to solve, but the solution could probably be improved quite a bit. Solution #1 in R is as follo...

Read more »

Project Euler Problem #28

March 2, 2009
By

Problem 28 on the Project Euler website asks what is the sum of both diagonals in a 1001×1001 clockwise spiral. This was an interesting one: the relationship between the numbers on the diagonals is easy to deduce, but expressing it succinctly in R...

Read more »

Project Euler Problem #22

March 1, 2009
By

Problem 22 on Project Euler proves a text file containing a large number of comma-delimited names and asks us to calculate the numeric sum of the alphabetical score for each name multiplied by the name’s position in the original list. This is mad...

Read more »

Project Euler Problem #15

February 22, 2009
By

Problem 15 on Project Euler asks us to find the number of distinct routes between the top left and bottom right corners in a 20×20 grid, with no backtracking allowed. I originally saw this type of problem tackled in the book Notes On Introductory ...

Read more »

Project Euler Problem #13

February 21, 2009
By

Problem 13 on Project Euler asks us to sum 100 50-digit numbers and give the first 10 digits of the result. This is pretty easy. Note we are using R’s integer division operator %/% to discard the remainder of the large summed integer and just giv...

Read more »

Project Euler Problem #14

February 21, 2009
By

Problem 14 on the Project Euler site asks us to find the longest chain under 1 million created using the Collatz mapping. This is fairly straightforward, although performance again is not great: ## Problem 14 # Collatz conjecture problem14 <-&...

Read more »