RosettaCodeData/Task/Mertens-function/Zkl/mertens-function-2.zkl

10 lines
387 B
Plaintext

mertensW().walk(199)
.pump(Console.println, T(Void.Read,19,False),
fcn{ vm.arglist.pump(String,"%3d".fmt) });
println("\nIn the first 1,000 terms of the Mertens sequence there are:");
otm:=mertensW().pump(1_000,List);
otm.reduce(fcn(s,m){ s + (m==0) },0) : println(_," zeros");
otm.reduce(fcn(p,m,rs){ rs.incN(m==0 and p!=0); m }.fp2( s:=Ref(0) ));
println(s.value," zero crossings");