RosettaCodeData/Task/Mertens-function/Quackery/mertens-function.quackery

38 lines
707 B
Plaintext

[ ' [ 0 ]
swap 1+ times
[ dup -1 peek
i^ 1+ mobius
+ join ]
behead drop ] is mertens ( n --> [ )
[ say " "
99 times
[ dup i^ peek
dup dup
-1 > if sp
abs 10 < if sp
echo
i^ 1+ 10 mod
9 = if cr ]
drop ] is grid ( [ --> )
[ 0 swap
witheach
[ 0 = + ] ] is zeroes ( [ --> n )
[ 0 0
rot witheach
[ dup 0 =
rot 0 !=
and
rot + swap ]
drop ] is crossings ( [ --> n )
1000 mertens
say "First 99 terms:"
cr
dup grid
cr
dup zeroes echo say " zeroes and "
crossings echo say " crossings"