get "libhdr" let totient(n) = valof $( let tot = n and i = 2 while i*i <= n $( if n rem i = 0 $( while n rem i = 0 do n := n / i tot := tot - tot/i $) if i=2 then i:=1 i := i+2 $) resultis n>1 -> tot-tot/n, tot $) let start() be $( let count = 0 writes(" N Totient Prime*N") for n = 1 to 25 $( let tot = totient(n) let prime = n-1 = tot if prime then count := count + 1 writef("%I2 %I7 %S*N", n, tot, prime -> " Yes", " No") $) writef("Number of primes up to %I6: %I4*N", 25, count) for n = 26 to 10000 $( if totient(n) = n-1 then count := count + 1 if n = 100 | n = 1000 | n = 10000 then writef("Number of primes up to %I6: %I4*N", n, count) $) $)