one-file-projects/flooring.rkt

10 lines
195 B
Racket
Raw Normal View History

2014-11-04 13:02:25 +01:00
#lang racket
(define (f i N M)
(modulo (* (expt i 4) (floor (/ N i))) M))
(define (flooring N M)
(modulo (for/sum ([i (in-range N)]) (f (+ i 1) N M)) M))
(displayln (flooring 12412 5123))