Using distcc to speed up Linux builds

distcc is a clever little program that allows you to distribute compilations to many machines, across the network. If you have a bunch of machines running the same operating systems and compilers, it’s quite easy to use: start the daemon on all the machines you wish to serve compilation jobs to, tell the host doing the compiling to use distcc rather than gcc or g++ and compile away!

The problem comes about when the systems aren’t running the same OS. For example: I have an older Linux laptop that I occasionally build things on, but a much faster MacOS X desktop machine. The solution in this case is a cross-compiler. A full-fledged cross-compiler is a complicated thing and requires an obnoxious amount of preparation, but for the purposes of distcc, one can avoid most of the headache.

Continue reading

The 3n + 1 problem

The 3n + 1 problem is deceptively simple. Consider a function f(n) and a sequence ai where:

f(n) = 3n+1 where n is odd
  n/2 where n is even

ai = n where i = 0
  f(ai-1) where i > 1

The Collatz conjecture states that ai will become 1 for some i regardless of what value of n is chosen initially. It remains to date a conjecture as there is no proof for it, but there is no counterexample either.

Continue reading