Category

Project Euler Solutions in R

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.

Peter Prevos Project Euler progressMy 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.

Laser Beams and Elliptical Billiards: Euler Problem 144

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.

Pandigital Products: Euler Problem 32

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 →

Digit fifth powers: Euler Problem 30

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 →

Euler Problem 29: Distinct Powers

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

The Ulam Spiral: Euler Problem 28

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?

Generating Quadratic Primes: Euler Problem 27

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

The Viral Recurring Decimal: Euler Problem 26

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.

Large integers in R: Fibonacci number with 1000 digits, Euler Problem 25

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?

Lexicographic Permutations: Euler Problem 24

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 →

Euler Problem 23: Non-Abundant Sums

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.

© 2018 The Devil is in the Data — Powered by WordPress

Theme by Anders NorenUp ↑

Subscribe to The Devil is in the Data

Enter your email address to receive notifications of new articles by email.

%d bloggers like this: