(let ((fft (fileVal "finiteField")) (do ((fileVal "Do") 'Do))) (lambda (p q) (let ((GFp (fft p))(pq (expt p q))) (let ((p->i (GFp 'p->i)) (i->p (GFp 'i->p)) (rec (make-string pq #\0))(f* (((GFp 'fops) ((GFp 'gsip) q)) 'f*))) (do pq (lambda (p) (string-set! rec (p->i (let ((p (i->p (+ 1 p))))(f* p p))) #\1))) (let ((c 0)) (do pq (lambda (n) (if (eq? (string-ref rec n) #\1) (set! c (+ c 1))))) (cons (* 2 c) pq)))))) ; Demo ((fileVal "ffqr") 23 4) ; => (279840 . 279841) ; I think that for p an odd prime and q > 0, (ffqr p q) => (p^q - 1 . p^q)