#### Eadaoin and a dog at Knocksink Woods

A dog arrived and a dog left. Our story lies somewhere in between.

A dog arrived and a dog left. Our story lies somewhere in between.

Cookie never stops stalking. Not once, not ever, not even for a second.

I have no idea how Cookie found it comfortable underneath my laptop, let alone for six hours, but six hours she stayed.

I sat on these photographs for a week while I agonized about colours and controls. Too much contrast? Too yellow? Too saturated? In the end I decided to present them as-is.

Functional JavaScript is cleaner than my C# solution, for sure! const raw = '731..450'; // Snipped for clarity. const chunkSize = 13; const multiply = (previous, current) => previous * current; const largest = (previous, current) => current > previous ? current : previous; function chop(string, size, chunks) { chunks = chunks || []; if […]

Whenever you start to complain First take the time to git blame!

Once again, it’s more readable than my last solution. I used a generator to get the next triangle. function divisorCount(number) { let end = Math.ceil(Math.sqrt(number)); let divisorCount = 0; for (let i = 1; i < = end; i++) { if (!(number % i)) { divisorCount += 2; } } return divisorCount; } function* triangleGenerator(number) […]

Again, better. :) #!/usr/bin/env node const fs = require('fs'); const add = previous, current) => previous + current; const toNumbers = string => { return string.split('').map((_, index) => string.charCodeAt(index) % 64); } fs.readFile('./p022_names.txt', 'utf8', (_, data) => { const names = JSON.parse(['[', data, ']'].join('')).sort(); const reduced = names.map((name, index) => { return toNumbers(name).reduce(add) * (index […]

#24 defeated the fuck out of me first time through: My solution to this was basically stolen elsewhere, and it took me a whole year to come back, sit down, and work through my own solution. The poor wording (I’ve since edited it) of the Wikipedia article didn’t help me. The specific piece of information […]

Ruby this time, and a wee bit shorter too. (2**1000).to_s.split(//).map(&:to_i).reduce(:+)

I went back and owned the fuck out of Problem 24. I present to you a fully-functional functional lexicographic permutation generator generator. Hail Satan! \m/ #!/usr/bin/env node const lexicographer = require('lexicographer'); const array = [...Array(10).keys()]; const breakpoint = 1000000; let permutations = 0; for (let value of lexicographer.permute(array)) { permutations++; if (permutations === breakpoint) { […]

function range(start, end) { return [...Array(end + 1).keys()].slice(start); } function palindrome(number) { return number.toString() === number.toString().split('').reverse().join(''); } function toBinary(number) { return (number >>> 0).toString(2); } function add(sum, current) { return sum + current; } const palindromes = range(1, 999999).filter(number => { return palindrome(number) && palindrome(toBinary(number)); }); console.log(palindromes.reduce(add));

The new solution for Problem #18 (compared to the old one) is more elegant: I reverse and reduce the triangle in a manner that doesn’t require me to check. The solution for #67 is a bit more longform, so I turned the method I use here into an NPM package: Triangutron. const eighteen = ` […]

Problem #30 was solved on new ground: my first run through Project Euler was in rigid order of first to last ending at #25. The recent round of solutions mostly cover old ground, which works well for me by itself because it shows off how my code has improved since 2012. Also, the run of […]