read -d\ a z="Wait, that's not a number..." for((b=10#${a:?},z=0,i=a+199999?2:-a;b/2;b%i?++i:(z+=a/i,b/=i))){ : } echo $z . *