35 lines
856 B
Plaintext
35 lines
856 B
Plaintext
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
|