#!/usr/bin/perl -w use strict; use integer; my ($a, $b, $c, $d, $e, $g, @f) = (10000, 0, 2800, 0, 0, 0, (0)x2801); for (;$b-$c;) { $f[$b++]=$a/5; } for (; $d=0, $g=$c*2; $c-=14, printf("%.4d",$e+$d/$a), $e=$d%$a) { for($b=$c; $d+=$f[$b]*$a,$f[$b]=$d%--$g,$d/=$g--,--$b; $d*=$b) { } } exit 0;