On Thu, Oct 19, 2000 at 12:16:59AM +0300, Ilmari Karonen wrote: > > > On Wed, 18 Oct 2000 yanick1@sympatico.ca wrote: > > perlgolf hole - Digital Root > > Write a subroutine to compute the digital root of any whole number argument. > > > > sub hole {pop=~/./;$'?hole($&+$'):$&} > > So what's wrong with the arithmetic approach? > > sub hole {$_&&(abs($_)-1)%9+1} > > If the numbers were known to be positive, ($_-1)%9+1 would suffice. Same comments as my previous message. Nice work, and that was a mistake in the description. :) Ronald ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe