Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Totient-function/Quackery/totient-function.quackery
Normal file
31
Task/Totient-function/Quackery/totient-function.quackery
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
[ [ dup while
|
||||
tuck mod again ]
|
||||
drop abs ] is gcd ( n n --> n )
|
||||
|
||||
|
||||
[ 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 ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue