Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
15
Task/M-bius-function/PascalABC.NET/m-bius-function.pas
Normal file
15
Task/M-bius-function/PascalABC.NET/m-bius-function.pas
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
uses school;
|
||||
|
||||
function mobius(n: integer): integer;
|
||||
begin
|
||||
var factors := n.Factorize;
|
||||
if factors.Count = factors.ToSet.Count then
|
||||
result := if factors.Count.IsEven then 1 else -1
|
||||
else result := 0
|
||||
end;
|
||||
|
||||
begin
|
||||
println('Mobius numbers from 1..99:');
|
||||
for var n := 1 to 99 do
|
||||
write(mobius(n):3, if n mod 20 = 0 then #10 else '');
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue