Loading [MathJax]/extensions/tex2jax.js

2010年7月20日火曜日

Compare the two methods of calculating Euler's totient function

;; P38 (*) Compare the two methods of calculating Euler's totient function.
;; Use the solutions of problems P34 and P37 to compare the algorithms. Take the number of logical inferences as a measure for efficiency. Try to calculate phi(10090) as an example.
> (time (phi 10090))
cpu time: 0 real time: 1 gc time: 0
4032
> (time (totient-phi 10090))
cpu time: 4 real time: 4 gc time: 0
4032
>
view raw p38.ss hosted with ❤ by GitHub

0 件のコメント:

コメントを投稿