#!perl -l $_*=$}%1e6,/0*$/,$}=$`for++$}..pop;print$}%10 |
#!perl -l ($}=$}*$_%1e6)=~s~0*$~~for++$}..pop;print$}%10 |
#!perl -l ($}=$}*$_%1E6)=~s/0*$//for++$}..pop;print$}%10 |
#!perl -l ($}=$}*$_%1E6||1)=~s/0*$//for$~..pop;print$}%10 |
This solution is longer than my best one, unfortunately $` is not global
#!perl -l ($`*$_%1E6||1)=~/0*$/,$~=$`for$~..pop;print$~%10 |
#!perl -l ($}=$}*$_%1E6)=~s/0*$//for($}=1)..pop;print$}%10 |
#!perl -l
$_=1;for$~(1..pop){$_*=$~;s/0*$//;$_%=1E6}print$_%10
|
Same thing a bit shorter
#!perl -l $_=1;s~.*([^0])~$&*$}%9e9~ewhile$}++<=$ARGV[0];print$1 |
I wonder if this one really works - I only had the time for the first 14 tests ;)
#!perl -l $_=1;s~([^0])+~$&*$}%1e6~egwhile$}++<=$ARGV[0];print$1 |
#!perl -l
$_=1;for$a(1..pop){$_*=$a;s/0*$//;$_%=1000000}print $_%10
|
Just another nice solution, a bit too long though...
#!perl -l $_=1;z while s~.*([^0])~$}++<$ARGV[0]?$&*$}%9e9:!print$1~e |