Balancing Latency and Authority in Globally Distributed Systems

A presentation to try to dissuade my colleagues from using MongoDB as an authoritative data store in a geo-distributed service
Read in 1 minutes

About Me

All about me!
Read in 1 minutes

Everything

All Content from Too Many Words
Read in 0 minutes

MongoDB and the Dangers of Schema Rot

My employer, like many web companies over the past few years, has been undergoing a slow but steady transition from a single, monolithic code base to a service oriented architecture. Our reasons are pretty standard – the team is growing, everyone wants to be able to develop without worrying about stepping on other developers’ toes – but we have one obstacle that makes our situation unique: our primary data store is a single MongoDB database that contains six years of production data, and all services are expected to affect the public-facing website by directly modifying said database.
Read in 3 minutes

Efficiency in Roman expression

It’s been a while since I tried my hand at Project Euler, and in the meantime, I seem to have forgotten a good deal about C# syntax. I wrote the solution to problem 89 in python, as it seemed easier to get my sea legs back in that language.

Read in 2 minutes

Pandigitals with prime-divisible substrings

Problem 43 asks for a lot, at least it terms of the sheer number of conditions it imposes on potential answers: The number, 1406357289, is a 0 to 9 pandigital number because it is made up of each of the digits 0 to 9 in some order, but it also has a rather interesting sub-string divisibility property. Let d1 be the 1st digit, d2 be the 2nd digit, and so on.
Read in 3 minutes

Multiple permutations

Woohoo! I’ve gotten through all Euler problems solved by more than 20,000 people — not an official milestone, but one that feels important nonetheless. The last of these, the tersely-worded problem 52, concerned multiples/permutations: It can be seen that the number, 125874, and its double, 251748, contain exactly the same digits, but in a different order. Find the smallest positive integer, x, such that 2x, 3x, 4x, 5x, and 6x, contain the same digits.
Read in 2 minutes

Circular primes

A circular prime, according to Project Euler, is a prime whose cyclical permutations are themselves prime:

The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime.

There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97.

Read in 2 minutes

Fractions of a decimal fraction

Problem 40 asks for information that should be easily obtainable by a couple of for loops and a heap of processing power: An irrational decimal fraction is created by concatenating the positive integers: 0.123456789101112131415161718192021… It can be seen that the 12th digit of the fractional part is 1. If d n represents the nth digit of the fractional part, find the value of the following expression. d1 × d10 × d100 × d1000 × d10000 × d100000 × d1000000 The simple way to do this would be to construct a million-character string and then pull d[0], d[9], d[99], &c., convert each to an integer, and find the product.
Read in 2 minutes

Yet another naive BigInteger solution

Problem 29 looks like it should take forever to solve by brute force.

Read in 1 minutes

Factorials of digits

Problem 34 is a slightly modified version of problem 30, so I solved the former with a slightly modified version of the code I used to solve the latter. It took slightly longer to run, as 9! is greater than 95, meaning that the central for loop of my program ran to a higher ceiling (7 × 9! (~2.5 million) rather than 6 × 95 (~350,000)).

Read in 1 minutes

Powers of digits

I was a bit stumped at first by problem 30, which reads,

Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:

1634 = 14 + 64 + 34 + 44
8208 = 84 + 24 + 04 + 84
9474 = 94 + 44 + 74 + 44

(As 1 = 14 is not a sum it is not included.)

The sum of these numbers is 1634 + 8208 + 9474 = 19316.

Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.

Read in 1 minutes

Bases and palindromes

Since getting to level 1, I’ve been doing Euler problems in order of difficulty instead of in the order they’re presented on the site. The next one up was problem 36

Read in 1 minutes

Spiral square diagonals

Problem 28 is the last problem I’ll be tackling today and the first trick question I’ve encountered on Project Euler. Take note of both the diction and the example given:

Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:

21 22 23 24 25
20  7  8  9 10
19  6  1  2 11
18  5  4  3 12
17 16 15 14 13
Read in 1 minutes

The last digits of large numbers

Problem 48, the next challenge in Project Euler when they’re sorted by ascending difficulty, seemed a bit familiar. It asks you to come up with a very large number and then report back the last few digits thereof. It reads: The series, 11 + 22 + 33 + … + 1010 = 10405071317. Find the last ten digits of the series, 11 + 22 + 33 + … + 10001000. .NET makes this kind of problem extremely easy, as all one has to do is use BigIntegers to add all members of the series together.
Read in 2 minutes