Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
34
Task/Mertens-function/XPL0/mertens-function.xpl0
Normal file
34
Task/Mertens-function/XPL0/mertens-function.xpl0
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
integer M ( 1+1000 );
|
||||
integer K, Zero, Cross, N;
|
||||
begin \compute values of the Mertens function
|
||||
\Generate Mertens numbers
|
||||
M( 1 ) := 1;
|
||||
for N := 2 to 1000 do begin
|
||||
M( N ) := 1;
|
||||
for K := 2 to N do M( N ) := M( N ) - M( N / K )
|
||||
end;
|
||||
\Print table
|
||||
Text(0, "The first 99 Mertens numbers are:^m^j");
|
||||
Text(0, " " );
|
||||
K := 9;
|
||||
for N := 1 to 99 do begin
|
||||
Format(3, 0);
|
||||
RlOut(0, float(M(N)));
|
||||
K := K - 1;
|
||||
if K = 0 then begin
|
||||
K := 10;
|
||||
CrLf(0);
|
||||
end
|
||||
end;
|
||||
\Calculate zeroes and crossings
|
||||
Zero := 0;
|
||||
Cross := 0;
|
||||
for N :=2 to 1000 do begin
|
||||
if M( N ) = 0 then begin
|
||||
Zero := Zero + 1;
|
||||
if M( N - 1 ) # 0 then Cross := Cross + 1
|
||||
end
|
||||
end;
|
||||
Text(0, "M(N) is zero "); IntOut(0, Zero); Text(0, " times.^m^j" );
|
||||
Text(0, "M(N) crosses zero "); IntOut(0, Cross); Text(0, " times.^m^j" );
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue