Created
July 10, 2021 10:26
-
-
Save plaster/2095d84b58733554a995f942b581fea2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use srfi-42) | |
(use math.prime) | |
(define (solve N) | |
(let* [[v (make-vector N)] | |
[%%solve (^ (n k) (let [[x (vector-ref v k)] | |
[y (vector-ref v (- n k 1)) ]] | |
(max (+ x y) (* x y))))] | |
[%solve (^ (n) (if (zero? n) 1 | |
(max-ec (: k n) (%%solve n k))))] | |
] | |
(do-ec (: n 0 N) | |
(vector-set! v n (%solve n))) | |
(vector-ref v (- N 1)))) | |
(define (main args) | |
(let1 answer ($ solve $ string->number $ cadr args) | |
(print answer) | |
(print (mc-factorize answer)) | |
0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ル╹ヮ╹ルɔ MIKA:~/work | |
% gosh pm.scm 100 | |
7412080755407364 | |
(2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3) | |
ル╹ヮ╹ルɔ MIKA:~/work | |
% gosh pm.scm 101 | |
11118121133111046 | |
(2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3) | |
ル╹ヮ╹ルɔ MIKA:~/work | |
% gosh pm.scm 102 | |
16677181699666569 | |
(3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment