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.

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:

Continue reading

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

library(gmp) print(substring((sum(as.bigz(readLines("euler13.txt")))), 0, 10))

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 <- as.matrix(read.table("clipboard",sep=" "))

I got Visual Studio 2017 through Microsoft’s Dreamspark promotion and thought I’d give it a try. I haven’t done a lot of development under Windows because its only on my laptop and my Linux desktop has 12 Gb RAM.

Continue reading

© 2019 The Midlife Geek

Theme by Anders Noren — Up ↑