bit shifting is better than recursion.

Haskell - Grains
... is better than n-1

Ruby - Hamming