Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Sylvesters-sequence/Perl/sylvesters-sequence.pl
Normal file
14
Task/Sylvesters-sequence/Perl/sylvesters-sequence.pl
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use feature 'say';
|
||||
use List::Util 'reduce';
|
||||
use Math::AnyNum ':overload';
|
||||
local $Math::AnyNum::PREC = 845;
|
||||
|
||||
my(@S,$sum);
|
||||
push @S, 1 + reduce { $a * $b } @S for 0..10;
|
||||
shift @S;
|
||||
$sum += 1/$_ for @S;
|
||||
|
||||
say "First 10 elements of Sylvester's sequence: @S";
|
||||
say "\nSum of the reciprocals of first 10 elements: " . float $sum;
|
||||
Loading…
Add table
Add a link
Reference in a new issue