one-file-projects/flooring.rkt

9 lines
195 B
Racket

#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))