Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
35
Task/Mertens-function/PL-I/mertens-function.pli
Normal file
35
Task/Mertens-function/PL-I/mertens-function.pli
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
mertens: procedure options(main);
|
||||
%replace MAX by 1000;
|
||||
|
||||
declare M(1:MAX) fixed binary(5);
|
||||
declare (n, k) fixed binary(10);
|
||||
declare (isZero, crossZero) fixed binary(8);
|
||||
|
||||
M(1) = 1;
|
||||
do n = 2 to MAX;
|
||||
M(n) = 1;
|
||||
do k = 2 to n;
|
||||
M(n) = M(n) - M(divide(n,k,10));
|
||||
end;
|
||||
end;
|
||||
|
||||
put skip list('The first 99 Mertens numbers are:');
|
||||
put skip list(' ');
|
||||
do n = 1 to 99;
|
||||
put edit(M(n)) (F(3));
|
||||
if mod(n,10) = 9 then put skip;
|
||||
end;
|
||||
|
||||
isZero = 0;
|
||||
crossZero = 0;
|
||||
do n = 2 to MAX;
|
||||
if M(n) = 0 then do;
|
||||
isZero = isZero + 1;
|
||||
if M(n-1) ^= 0 then
|
||||
crossZero = crossZero + 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
put skip list('Zeroes: ',isZero);
|
||||
put skip list('Crossings:',crossZero);
|
||||
end mertens;
|
||||
Loading…
Add table
Add a link
Reference in a new issue