From 0475bc2b55cae31afe4023d7bdbb43fb6c041fb9 Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Thu, 18 Dec 2025 15:03:23 -0500 Subject: [PATCH] [p10] This is it. it works. Part 2 is done --- p10/p10.org | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/p10/p10.org b/p10/p10.org index f004b88..8346974 100644 --- a/p10/p10.org +++ b/p10/p10.org @@ -208,38 +208,6 @@ These are some auxiliary functions to create and deal with matrices #+RESULTS: | 19 | 16 | 12 | 11 | 0 | 8 | 14 | 3 | 8 | -#+begin_src emacs-lisp - (setq rainbow (-annotate (lambda (n) (--map (mod n it) '(2 3 5 7))) (-iota (* 2 3 5 7)))) - - (-sum - (let ((machine-id 0)) - (-each machines (lambda (machine) - (let* ((matrix (-distinct (matrix-buttons (fix-machine machine)))) - (solmod (--map (solve-well-ordered-chunks-mod matrix it) '(2 3 5 7))) - (solns nil) - (numcand (apply '* (-map 'length solmod))) - (count 0)) - ;; Oh Programming Gods, have mercy of me for I have sinned - (-each (car solmod) - (lambda (a) - (-each (cadr solmod) - (lambda (b) - (-each (caddr solmod) - (lambda (c) - (-each (cadddr solmod) - (lambda (d) - (let ((cand (--map (cdr (assoc it rainbow)) (-zip-lists a b c d)))) - (message (format "machine %d. Verifying %d / %d - found %d" machine-id (setq count (1+ count)) numcand (length solns))) - (when (test-soln matrix cand) (push cand solns))))))))))) - (setq machine-id (1+ machine-id)) - (-min (-map '-sum solns)) - ) - - ) - - )) - ) -#+end_src #+begin_src emacs-lisp (setq rainbow (-annotate (lambda (n) (--map (mod n it) '(2 3 5 7))) (-iota (* 2 3 5 7)))) @@ -276,7 +244,7 @@ These are some auxiliary functions to create and deal with matrices #+end_src #+RESULTS: -: 33 +: 16474 #+RESULTS: (process-machine (nth 51 machines)) @@ -631,7 +599,7 @@ try to split into chunks #+end_src #+RESULTS: -: solve-well-ordered-chunks +: solve-well-ordered-chunks-mod Try to do it recursively #+begin_src emacs-lisp