Fork me on GitHub
#adventofcode
<
2020-12-13
>
plexus06:12:14

Streaming day 13 in a few moments: https://youtu.be/ONclnLu3UqA

👍 2
oxalorg06:12:40

Looks like today's 2nd part might need some Modular arithmetic to solve 🙈

Vincent Cantin06:12:18

“In life, there are 92319243542196534129765432175643216314925319 kinds of people … those who can solve the math problems, and the others.”

😆 2
oxalorg06:12:30

I thought maybe today they want us to brute force it and I waited for 20 minutes for the brute force to complete before giving up 🙈

Vincent Cantin06:12:33

I tried brute forcing, but then I read the text again and I stopped torturing my 2011 mac book air.

😆 1
nbardiuk08:12:05

I've given up on brute forcing when it got too warm with laptop on my laps 🙂

fingertoe08:12:50

Brute force? or remember basic HS math from thirty years ago? Maybe my high schooler is up.. If only I was a CS major instead of MIS.. Maybe it will be debits and credits next?

😆 1
Vincent Cantin09:12:11

I think that those numbers large enough to fear a math overflow are a good hint that we need to be prepared to use https://clojuredocs.org/clojure.core/bigint and its friends.

thom18:12:47

Only just found this channel and running a bit behind, but I've been putting up marginalia versions of my solutions at: https://lemonwatcher.com/advent.html

👍 3
😍 1
thom18:12:55

apologies for any and all crimes against Clojure

Stuart18:12:26

Bit stuck on part 2 today, not sure what I'm missing: Given the busses in positions

19 is pos 0
41 is pos 9
37 is pos 13
367 is pos 19
13 is pos 32
17 is pos 36
29 is pos 48
373 is pos 50
23 is pos 73
I have calculated the answer to the problem I think I've to solve as :
561773853149685
Because
(mod 561773853149685 19)
=> 0

(mod 561773853149685 41)
=> 32 (41 - 9 = 32)

(mod 561773853149685 37)
=> 24 (37 - 13 = 24)

(mod 561773853149685 367)
=> 348 (367 - 19 = 348) as 367 is in the 19th pos.

(mod 561773853149685 13)
=> 7 (13-32 mod 13 = 7) as 13 is in the 32nd pos

(mod 561773853149685 17)
=> 15 (17 - 36 mod 17) as 17 is in the 36th pos.

(mod 561773853149685 29)
=> 10 (29 - 48 mod 29)

(mod 561773853149685 373)
=> 273 (373 - 50)

(mod 561773853149685 23)
=> 19 (23 - 73 mod 23)
What am I misunderstanding?

Stuart19:12:34

I think my entire idea on how I can solve this doesnt work at all. damn

ryan echternacht21:12:58

it recommends starting at 15 places (100000000000000). Is this a good starting place?

ryan echternacht21:12:21

and is there some smart math form of this (using LCM?). I couldn't figure one out given the offsets

erwinrooijakkers21:12:43

It’s literally the Chinese remainder theorem

erwinrooijakkers21:12:58

Using LCM I don’t know

Stuart21:12:52

Well, all my buses are primes. So the least common multiplier between any 2 buses is just bus 1 * bus 2

rfisher23:12:07

I enjoy these when they're programming puzzles. It's not so much fun when I have to try (and fail) to independently work out some mathematical theorem I've never heard of.

rfisher23:12:22

That's not a moan, other than at myself for never learning mathematics 🙂

ryan echternacht02:12:15

I agree @U0132B7P7C6. While it might literally be the Chinese remainder theorem, that's not the part of programming I enjoy/use often

Jeff Evans18:12:44

Agreed with the above. There are times when the “math puzzle” piece is interesting, but at least for me, personally, I’m trying to build up my Clojure skills through this exercise. I managed to Google my way to the Chinese remainder theorem (and this thread), and happy to see others are in the same boat. This is one case where I was happy to copy/paste some code. 😆 https://github.com/jeff303/advent-of-code-2020/blob/master/src/advent_of_code/day13.clj#L80

Joe21:12:50

@ryan072 check out the day 13 answers thread - plenty of advice in there.

Stuart22:12:35

finally! Got a solution that works for part 2. I had 12 failed attempts at this one!

metal 6
ryan echternacht23:12:54

Thanks. I got it figured out