RosettaCodeData/Task/Totient-function/Quackery/totient-function.quackery

27 lines
583 B
Plaintext

[ 0 swap dup times
[ i over gcd
1 = rot + swap ]
drop ] is totient ( n --> n )
[ 0 temp put
times
[ i dup 1+ totient
= temp tally ]
temp take ] is primecount ( n --> n )
25 times
[ say "The totient of "
i^ 1+ dup echo
say " is "
dup totient dup echo
say ", so it is "
1+ != if say "not "
say "prime." cr ]
cr
' [ 100 1000 10000 100000 ]
witheach
[ say "There are "
dup primecount echo
say " primes up to " echo
say "." cr ]