## CJam (<strike>25 24</strike> 22 bytes) {:X!X{X\2*)%!4*+~)}/z} [Online demo](http://cjam.aditsu.net/#code=17%2C%0A%0A%7B%3AX!X%7BX%5C2*\)%25!4*%2B~\)%7D%2Fz%7D%0A%0A%25%60) This runs in pseudoquasilinear time* and uses the statement from the OEIS that > Moebius transform is period 4 sequence [ 4, 0, -4, 0, ...]. - Michael Somos, Sep 17 2007 The input `0` is obviously a special case (Möbius tranforms and annihilators don't go well together), but ended up only costing one char. \* Pseudo- because it's quasilinear in the value of the input, not the size of the input; quasi because it does `Theta(n)` operations on integers of size on the order of `n`; a `b`-bit mod operation should take `b lg b` time, so overall this takes `Theta(n lg n lg lg n)` time.