adventofcode

erdos 2024-12-13T05:36:49.395879Z

Day 13 - Solutions

erdos 2024-12-13T05:37:14.948999Z

I was considering performing a tree search there (because of the limitation to 100 button presses), but decided to go with some algebra, which made part 2 trivial. https://github.com/erdos/advent-of-code/blob/master/2024/day13.clj

👏🏻 1
Aleks 2024-12-13T05:57:41.617239Z

Yeah, I went this way too, as I expected something like +10000000000000 in Part 2 https://github.com/zelark/AoC/blob/master/src/zelark/aoc_2024/day_13.clj

roklenarcic 2024-12-13T06:17:44.037779Z

Yeh I expected numbers to go up, but stupidly I was staring at it and thinking “I probably need to use least common multiplier in some way”, that wasted like half an hour

Maravedis 2024-12-13T06:18:38.986479Z

Yeah, me too, I was looking at the chinese remainder theorem before just writing down the two equations and sorting it out.

Maravedis 2024-12-13T06:19:42.164919Z

Maths are mathing

2024-12-13T06:24:09.925129Z

Math, eh? I got an intuition for part 2 playing around a bit in wolfram. I eventually figured out what to do to and then spent way way too much time implementing the trivial math. Wheee https://gitlab.com/maximoburrito/advent2024/-/blob/main/src/day13/main.cljI

Maravedis 2024-12-13T06:24:15.015349Z

Oh shoot I missed a simplification, the equation is correct but it could be simpler 😅

2024-12-13T06:25:15.632369Z

ratio? Oh yeah, I guess that exists... 🙂

🙃 3
Andrew Byala 2024-12-13T07:25:59.111099Z

Thank you to those of you who said to solve the simultaneous equations. I have no patience when the problems require knowing which mathematical things to do, but once I got that hint I was able to solve them myself. • Blog: https://github.com/abyala/advent-2024-clojure/blob/main/docs/day13.md • Code: https://github.com/abyala/advent-2024-clojure/blob/main/src/advent_2024_clojure/day13.clj

genmeblog 2024-12-13T12:46:19.100889Z

Algebra solution here: https://github.com/genmeblog/advent-of-code/blob/master/src/advent_of_code_2024/day13.clj

tschady 2024-12-13T13:38:01.851719Z

genmeblog 2024-12-13T13:38:14.249829Z

First part can be also solved by linear optimization (simplex), part 2 is problematic since it works on doubles not longs...

genmeblog 2024-12-13T13:38:20.974709Z

;; Button A: X+94, Y+34
;; Button B: X+22, Y+67
;; Prize: X=8400, Y=5400
(fastmath.optimization/linear-optimization [3 1 0] [[94 22] :eq 8400
                                                    [34 67] :eq 5400
                                                    [1 0] :leq 100
                                                    [0 1] :leq 100])
;; => [(80.0 40.00000000000001) 280.0]

vollcheck 2024-12-13T14:00:25.930009Z

mine similar to others, required some googling as I already forgot about cramers technique https://github.com/vollcheck/aoc/blob/master/src/y24/day13.clj wrt misleading instructions, I wonder how Eric will try to deceive us in the following days

vollcheck 2024-12-13T14:07:31.517429Z

since part 1 I was wondering if logic programming would be suitable for that problem, will try to set up some PoC

tildedave 2024-12-13T14:15:38.724019Z

uh, so I solved the system equations mod p for a bunch of ps and then used CRT to see if the solution converged to the expected x/y. looking online it seems like this was perhaps overkill. https://github.com/tildedave/advent-of-code/blob/main/src/advent2024/day13.clj

bhauman 2024-12-13T14:37:01.367979Z

I’m glad todays was shorter as I really really need to study my lines. I’m playing Santa in a Christmas play. Dress rehearsal at 2! https://github.com/bhauman/adv2024/blob/main/src/adv2024/day13/sol.clj

1
bhauman 2024-12-13T14:37:37.401269Z

tschady 2024-12-13T15:15:39.790969Z

@bhauman “Ho ho… line!

😂 1
🎅 3
🎅🏻 1
1
Felipe 2024-12-13T15:25:52.450879Z

started with this, knowing it would be no good for a part 2

Felipe 2024-12-13T15:26:42.707049Z

ended up with this, which was shorter 🤦‍♂️

🩳 1
rjray 2024-12-13T16:48:15.919129Z

https://github.com/rjray/advent-2024-clojure/blob/master/src/advent_of_code/day13.clj Hammered out part 1 with brute-force to try to gain some time (I've had several days where I couldn't start the puzzles until hours after they unlocked). Part 2 would obviously need something that wasn't loop-based. After looking at it for some time, I realized that it looked like old linear algebra problems. Some googling and I found the WIkipedia page for Cramer's Rule and based my solution on that. For curiosity, I also ran part 1 through this code and dropped the run-time 91% over the brute-force. That said, the brute-force "quick" solution got me my first <1000 ranking for a part 1 finish.

Zach 2024-12-13T17:27:45.713319Z

Math ❤️

Apple 2024-12-13T18:49:02.689219Z

Apple 2024-12-13T18:53:36.281959Z

lucky there's no div-by-zero error in my case

Maravedis 2024-12-13T18:56:05.302399Z

Given it's basically the equation of two lines intersecting, I don't think it could be equal to zero unless the two were parallels? It's been a while since middle school.

Apple 2024-12-13T18:58:55.646129Z

Zach's code checks 0 and that reminds me it's possible.

Maravedis 2024-12-13T15:12:04.771129Z

Stolen from Reddit:

The Chief Historian is missing, and instead of actually helping the historians find them, 80% of the time you decide to do literally anything else.

    Tasks where you actually help the historians: 3
        1: Tech support
        6: Mission impossible
        7: Crossing that bridge when we came to it
    Tasks that take the opportunity to help someone else in the area: 7
        2: Helping a nuclear power plant
        3: Tech support, again
        4: Helping a child with their wordsearch
        5: Tech support, AGAIN
        9: Tech support, A G A I N
        10: Reindeer mountaineering
        12: Fencing (not the cool kind with swords)
    Tasks to thwart your arch nemesis: 1
        8: Thwarting the great chocolate heist
    Tasks where you do literally nothing useful: 2
        11: Watchin' rocks
        13: Pressing buttons 42 trillion times

😂 7
2024-12-13T16:50:38.532059Z

Not gonna let day 9 defeat us.

2024-12-13T16:53:03.218109Z

https://www.twitch.tv/timpote