importing projecteuler into git
[srid.projecteuler.git] / 5.scm
blob8ab2036c4a083ad668fa7c30b8a4770a2d9304d1
1 (require (only (lib "1.ss" "srfi") fold))\r
2 \r
3 (define (numbers a b)\r
4   (cond ((> a b) null)\r
5         (else (cons a (numbers (add1 a) b)))))\r
6 \r
7 (define (gcd a b)\r
8   (cond ((= a 0)\r
9          b)\r
10         ((= b 0)\r
11          a)\r
12         (else\r
13          (gcd b (modulo a b)))))\r
15 (fold gcd 1 (numbers 2 10))