## Project Euler Solutions in R

The Devil is in the Data website presents solutions to Project Euler problems in the R language for statistical computing. Project Euler (named after Swiss mathematician Leonhard Euler) is a competition with computational problems. Participants solve these problems using computer code, using many different languages.

This blog describes each problem in detail, including theoretical background and the complete code to find the solution. Some of the early problems are quite trivial, but they provide an excellent introduction to coding in R.

My aim is to complete the first 100 Euler problems and post a solution every Thursday (Australian time). I don’t claim to be an expert in R and love to read comments with improved alternative solutions.

If you are also solving Euler problems, then it would be fun to connect. My friend key is: 1009266_RbWqFI3r9PF44pD2d66syqRcmEaIqWi3.

Spoiler Alert: If you believe that the solutions to Project Euler problems should not be shared then do not read any further.

This article provides a solution in the R language for Euler Problem 144: How many times does a laser bounce inside an elliptical mirror before the light beam exits it? We can use the solution to this problem to simulate elliptical billiard tables.

Euler Problem 32 returns to pandigital numbers, which are numbers that contain one of each digit. Like so many of the Euler Problems, these numbers serve no practical purpose whatsoever, other than some entertainment value. You can find all pandigital… Continue Reading →

Euler problem 30 is another number crunching problem that deals with numbers to the power of five. Two other Euler problems dealt with raising numbers to a power. The previous problem looked at permutations of powers and problem 16 asks for… Continue Reading →

Proposed solution to Euler Problem 29: Distinct Powers in the R language for statistical computing.

Proposed solution to Euler Problem 28 in the R language for statistical computing. What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral?

Solution to Euler Problem 27 using the R language. Find the product of the coefficients for the quadratic expression that produces the most primes.

Proposed solution to Euler Problem 26 in the R language. Find the value of d < 1000 for which 1/d contains the longest recurring decimal cycle.

Solution to Euler Problem 25 in the R language. What is the index of the first term in the Fibonacci sequence to contain 1000 digits?

Euler Problem 24 asks to develop lexicographic permutations which are ordered arrangements of objects in lexicographic order. Tushar Roy of Coding Made Simple has shared a great introduction on how to generate lexicographic permutations. Euler Problem 24 Definition A permutation is… Continue Reading →

A solution in the R language to Euler Problem 23. Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers.