RosettaCodeData/Task/Totient-function/Quackery/totient-function.quackery
2023-09-16 17:28:03 -07:00

26 lines
583 B
Text

[ 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 ]