Skip to content

Latest commit

 

History

History
41 lines (23 loc) · 836 Bytes

27.rst

File metadata and controls

41 lines (23 loc) · 836 Bytes

练习 1.27

我们将这个测试函数称之为 carmichael-test ,对于给定参数 n ,它要检验所有少于 n 的数 aa^n 是否都与 an 同余:

.. literalinclude:: code/27-carmichael-test.scm

然后,按照书本 35 页脚注 47 里的 Carmichael 数一个个进行测试:

1 ]=> (load "27-carmichael-test.scm")

;Loading "27-carmichael-test.scm"...
;  Loading "p34-expmod.scm"... done
;... done
;Value: congruent?

1 ]=> (carmichael-test 561)

;Value: #t

1 ]=> (carmichael-test 1105)

;Value: #t

1 ]=> (carmichael-test 1729)

;Value: #t

1 ]=> (carmichael-test 2465)

;Value: #t

1 ]=> (carmichael-test 2821)

;Value: #t

1 ]=> (carmichael-test 6601)

;Value: #t