; Seek primes in arithmetic sequence a + n*b. ; http://cap-lore.com/code/mult/ff.txt ; http://en.wikipedia.org/wiki/Miller-Rabin_primality_test (lambda (a b)(let* ( ; (ex (lambda (m v) (write (list "ex" m v))(newline) v)) (pl (list 2 3 5 7 11 13 17))(sm (apply * pl))(lim (* 17 17)) (mod-exp (fileVal "mod-exp")) (pt ((fileVal "Miller-Rabin") 'base)) (ww (lambda(n x)(display (list n x)) x)) (g (gcd a b))(n (modulo b sm)) (random ((((fileVal "RC4") "ijos") 'rbi) (+ a (if (positive? b) -3 (* 2000 b)))))) (if (> g 1) (list "Always divisible by" g) (let more ((a a)(m (modulo a sm))(cn 0)) (or (and (<= a lim) (let pd ((pl pl)) (or (and (null? pl) a) (and (= a (car pl)) a) (and (positive? (remainder a (car pl))) (pd (cdr pl)))))) (let ((m (modulo a sm))) (if (and (let all ((l pl)) (or (null? l) (and (positive? (remainder m (car l))) (all (cdr l))))) (let all ((l 20)) (or (zero? l) (and (ww cn (pt (+ 2 (random)) a)) (all (- l 1)))))) a (begin (display ",")(more (+ a b)(modulo (+ m n) sm)(+ cn 1))))))))))