September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
8
Task/Arithmetic-Rational/Zkl/arithmetic-rational-2.zkl
Normal file
8
Task/Arithmetic-Rational/Zkl/arithmetic-rational-2.zkl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
foreach p in ([2 .. (2).pow(19)]){
|
||||
sum,limit := Rational(1,p), p.toFloat().sqrt();
|
||||
foreach factor in ([2 .. limit]){
|
||||
if(p%factor == 0) sum+=Rational(1,factor) + Rational(factor,p);
|
||||
}
|
||||
if(sum.b==1) println("Sum of recipr. factors of %6s = %s exactly%s"
|
||||
.fmt(p, sum, (sum==1) and ", perfect." or "."));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue