f=lambda n,k=1,m=1:n*(k>n)or f(n-(n%k<m%k)*n/k,k+1,m*k*k) for n in 1, 2, 3, 8, 9, 26, 44, 105: print '%3d => %2d' % (n,f(n))
Standard input is empty
1 => 1 2 => 1 3 => 2 8 => 4 9 => 6 26 => 12 44 => 20 105 => 48
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!