13 lines
370 B
Plaintext
13 lines
370 B
Plaintext
with (200) {|n|
|
|
say "Mertens function in the range 1..#{n}:"
|
|
(1..n).map { mertens(_) }.slices(20).each {|line|
|
|
say line.map{ "%2s" % _ }.join(' ')
|
|
}
|
|
}
|
|
|
|
with (1000) {|n|
|
|
say "\nIn the range 1..#{n}, there are:"
|
|
say (1..n->count_by { mertens(_)==0 }, " zeros")
|
|
say (1..n->count_by { mertens(_)==0 && mertens(_-1)!=0 }, " zero crossings")
|
|
}
|