Best Perl answer yet - 70 characters, and no extra modules (unless you count special features of 5.10):
perl -nE'sub f{($a)=@_;$a%$_||return$_,f($a/$_)for 2..$a}$,=x;say f$_'
Doesn't work for 1 or 0, but works fine for everything else. If you don't like using say
, or are using an earlier version of Perl, here's an 81 character version:
perl -ne'sub f{($a)=@_;$a%$_||return$_,f($a/$_)for 2..$a;}$,=x;$/="\n";print f$_'