1.33
secje
posted @ 2010年7月10日 07:09
in sicp
, 1658 阅读
(define (filtered-accumulate filter combiner null-value term a next b) (cond ((> a b) null-value) ((filter a) (combiner (term a) (filtered-accumulate filter combiner null-value term (next a) next b))) (else (filtered-accumulate filter combiner null-value term (next a) next b)))) (define (square x) (* x x)) (define (fast-prime? n) (define (expmod base exp m) (cond ((= exp 0) 1) ((even? exp) (remainder (square (expmod base (/ exp 2) m)) m)) (else (remainder (* (remainder base m) (expmod base (- exp 1) m)) m)))) (define (fermat-test a) (= (expmod a n n) a)) (define (test a) (cond ((= a 0) #t) ((fermat-test a) (fermat-test (- a 1))) (else #f))) (test (- n 1))) (define (indentity n) n) (define (inc n) (+ n 1)) (define (prime-add a b) (filtered-accumulate fast-prime? + 0 square a inc b)) (define (gcd a b) (if (= b 0) a (gcd b (remainder a b)))) (define (check-add n) (define (check m) (if (= (gcd m n) 1) #t #f)) (filtered-accumulate check * 1 indentity 1 inc n))
2022年9月23日 05:10
Download NCERT Sanskrit Sample Paper 2023 Class 9 gives the candidates a fair idea of new exam scheme or question pattern for all formats of the exam such as SA1, SA2, FA1, FA2, FA3, FA4 and Assignments. NCERT Sanskrit Sample Paper Class 9 These NCERT STD-9 Sanskrit Sample Paper 2023 were Designed based on the newly revised syllabus and curriculum in all formats of exams conductingin Term-1 & Term-2 of the course.Download NCERT Sanskrit Sample Paper 2023 Class 9 gives the candidates a fair idea of new exam scheme or question pattern for all formats of the exam such as SA1, SA2, FA1, FA2, FA3, FA4 and Assignments.
2023年7月06日 07:53
The provided code appears to be a Scheme implementation with various functions and procedures. It seems to involve calculations related to prime numbers, filtering, accumulation, and testing. seo training in kochi However, without further context or specific instructions, it is difficult to determine the exact purpose or significance of this code. Nonetheless, it showcases the use of functions and recursion in Scheme programming, which is commendable.