## The Midlife Geek

### Ramblings of a middle aged engineer, runner and open source enthusiast

#### Tag: R

Struggled to get my head around Euler problem 15:

Starting at the top left of a 20×20 grid and only moving right and down, how many routes are there?

I figured that this was a combinatorics problem but couldn’t see what to count or choose from.

Project Euler again, problem 19. How many Sundays fell on the first of the month in the twentieth century?

Brute force solution in R but it let me play around with the way R handles dates. Seems more straight forward than in many languages (looking at you Java).

Project Euler problem 25 is to find the index of the first Fibonacci number of 1000 characters. I used the gmp library – I couldn’t find a way to get the length of a bigz data type so converted it to a string:

Problem 13 is summing a list of fifty digit numbers. I used the gmp library and R to solve in 2 lines:

```library(gmp)

Not much more to say really. I forgot the problem asks for the first 10 digits, so my first answer was wrong.

OK so today I’m trying problem 12 – find the first triangular number with over 500 divisors. This is the first Project Euler problem I’ve really struggled to find a solution in a reasonable amount of time. Continue reading

I’m beginning to like R. You can capture table data from a connection (a generalised file), one of which is the clipboard, to a data frame.

```problem.matrix <-