Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Arithmetic-derivative/Perl/arithmetic-derivative.pl
Normal file
17
Task/Arithmetic-derivative/Perl/arithmetic-derivative.pl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use v5.36;
|
||||
use bigint;
|
||||
no warnings 'uninitialized';
|
||||
use List::Util 'max';
|
||||
use ntheory 'factor';
|
||||
|
||||
sub table ($c, @V) { my $t = $c * (my $w = 2 + length max @V); ( sprintf( ('%'.$w.'d')x@V, @V) ) =~ s/.{1,$t}\K/\n/gr }
|
||||
|
||||
sub D ($n) {
|
||||
my(%f, $s);
|
||||
$f{$_}++ for factor max 1, my $nabs = abs $n;
|
||||
map { $s += $nabs * $f{$_} / $_ } keys %f;
|
||||
$n > 0 ? $s : -$s;
|
||||
}
|
||||
|
||||
say table 10, map { D $_ } -99 .. 100;
|
||||
say join "\n", map { sprintf('D(10**%-2d) / 7 == ', $_) . D(10**$_) / 7 } 1 .. 20;
|
||||
Loading…
Add table
Add a link
Reference in a new issue