随笔分类 -  SICP

摘要:寻找素数因子要求用书中的smallest-divisor过程找出199, 1999, 19999的最小因子。Scheme Code:主要流程:定义寻找素数的过程如果2的平方即4,大于测试值,那么它肯定是素数如果n能和2整除,那么不是素数,最小因子是2如果不是,回到过程find-div,再试试能不能与... 阅读全文
posted @ 2015-01-23 19:21 Pxjw 阅读(613) 评论(0) 推荐(0)
摘要:题目: 采用递归计算过程计算出帕斯卡三角形的各个元素。row:0 11 1 12 1 2 13 1 3 3 14 1 4 6 4 15 . . . . . .col: 0 1 2 3 4//c++//递归#includeusing namespace std;int pascaler(int row... 阅读全文
posted @ 2015-01-14 12:46 Pxjw 阅读(502) 评论(0) 推荐(0)
摘要:SICP 1.7求平方根,要求更加精确Exercise 1.7. The good-enough? test used in computing square roots will not be very effective for finding the square roots of very ... 阅读全文
posted @ 2015-01-12 22:13 Pxjw 阅读(677) 评论(0) 推荐(0)