f=lambda n,k=2:n/k and[f(n,k+1),(n/k%k<1)+f(n/k)][n%k<1] for n in range(1, 16): print '%2d ->' %n, f(n)
Standard input is empty
1 -> 0 2 -> 0 3 -> 0 4 -> 1 5 -> 0 6 -> 0 7 -> 0 8 -> 2 9 -> 1 10 -> 0 11 -> 0 12 -> 1 13 -> 0 14 -> 0 15 -> 0
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!