## The Midlife Geek

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

#### Tag: Coding (page 1 of 3)

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:

Project Euler again, this time Python. The problem is to sort a list of 5000 names alphabetically then give them a value. For example “COLIN” is 3 + 15 + 12 + 9 + 14 = 53 and is the 938th item – so its value is 49714 (53*938).

Project Euler problem 21 is to find the sum of all amicable numbers under 10000. An amicable number is:

Let $$d(n)$$ be the sum of proper divisors of $$n$$ then $$d(a)=b$$ and $$d(b)=a$$ if $$a!=b$$ then $$a$$ and $$b$$ are amicable numbers.

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.

It’s been a mixed start to the new year. Watching what I eat for the rest of January, damn you Christmas. Back at work after three weeks off, achieved nothing and left by eleven. My ego got the better of me and I went for a run despite having a cold, so am now suffering. Need to shift it with the first cross country league race on Wednesday. I can’t help wondering why generic medicines are so much cheaper than brand names.

Finally got around to ordering a replacement Acer V3-112P screen. Replacement was straight forward. Like most avionics technicians, I breathed a sigh of relief when the LED panel lit up proving the fault. The old girl is now sitting running a million updates courtesy of Microsoft.

While many Linux advocates eschew Microsoft, I prefer Office (Home Use Program). Like current, I take the path of least resistance and I use Word and Excel so often I know them inside out. Linux is an outstanding development platform, I’m using it for TM470.

TM470 project preparation continues, reviewing both TM353 and TM354. FutureLearn is a fantastic resource with a course on Secure Android Development. Delivered by the University of Southampton, it started last week. I haven’t decided the tool chain yet, particularly versioning. I have used SVN and Bazaar, which I prefer as it integrates well with Launch Pad. I won’t be using LP though so should investigate Mercurial and Git.

Read Original Sin too – best Marvel I’ve read in ages. Like Murder She Wrote in space. A real page turner, I read it in one sitting.

Something that didn’t grip me was the Assassin’s Creed movie. It starts off quite well, with a similar story to the games. It suffers the same problem as earlier games though – the present interrupts more interesting stories in the past. What I don’t get though is why option a game as a property then try not to appeal to that market?

What I haven’t made time for though is the Nintendo Classic Mini. I played a little Ghosts ‘n Goblins – damn I forgot how hard games were then. I always thought as a kid that I’d somehow be better at them as an adult but I guess I didn’t factor in reactions.

An Android fitness tracker application. Feedback from the preparation forum was positive, there is enough scope to expand or contract the project as needed. Importantly, it is “substantially within the sphere of information technology”.

Taking approaches from IT Systems Planning for Success (TM353) and an Agile approach from Software Engineering (TM354) meets the requirements. There is a substantial part of the application that needs synchronise with a server, utilising another level 3 module Developing Concurrent Distributed Systems (M362).

What I haven’t decided is the title!