aboutsummaryrefslogtreecommitdiff
path: root/2015/day-25
diff options
context:
space:
mode:
authorHJ <thechairman@thechairman.info>2021-12-09 18:05:04 -0500
committerHJ <thechairman@thechairman.info>2021-12-09 18:05:04 -0500
commit527bc4762f9c66c9244f0ac1fbee6357478ac9ef (patch)
treeecd3ffc97de5aab201699f93aab1e0417ac3d25d /2015/day-25
downloadgleam_aoc-527bc4762f9c66c9244f0ac1fbee6357478ac9ef.tar.gz
gleam_aoc-527bc4762f9c66c9244f0ac1fbee6357478ac9ef.zip
putting all my solutions together in 1 repository
Diffstat (limited to '2015/day-25')
-rw-r--r--2015/day-25/day-25.rkt16
1 files changed, 16 insertions, 0 deletions
diff --git a/2015/day-25/day-25.rkt b/2015/day-25/day-25.rkt
new file mode 100644
index 0000000..786538c
--- /dev/null
+++ b/2015/day-25/day-25.rkt
@@ -0,0 +1,16 @@
+#lang racket
+
+(define max-r 2978)
+(define max-c 3083)
+
+(for/fold ([code 20151125]
+ [r 1]
+ [c 1])
+ ([i (in-naturals)]
+ #:break (and (= max-r r)
+ (= max-c c)))
+ (define new-code
+ (modulo (* code 252533) 33554393))
+ (if (= r 1)
+ (values new-code (add1 c) 1)
+ (values new-code (sub1 r) (add1 c))))