MAX=1000

m[1]=1
for n in `seq 2 $MAX`
do
    m[n]=1
    for k in `seq 2 $n`
    do
        m[n]=$((m[n]-m[n/k]))
    done
done

echo 'The first 99 Mertens numbers are:'
echo -n '   '
for n in `seq 1 99`
do
    printf '%2d ' ${m[n]}
    test $((n%10)) -eq 9 && echo
done

zero=0
cross=0
for n in `seq 1 $MAX`
do
    if [ ${m[n]} -eq 0 ]
    then
        ((zero++))
        test ${m[n-1]} -ne 0 && ((cross++))
    fi
done

echo "M(N) is zero $zero times."
echo "M(N) crosses zero $cross times."