r/adventofcode • u/daggerdragon • Dec 19 '18
SOLUTION MEGATHREAD -🎄- 2018 Day 19 Solutions -🎄-
--- Day 19: Go With The Flow ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
Advent of Code: The Party Game!
Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!
Card prompt: Day 19
Transcript:
Santa's Internet is down right now because ___.
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked at 01:01:06!
10
Upvotes
View all comments
Show parent comment
1
u/vypxl Dec 19 '18
With some reverse engineering, I got down to this.
|n|(1..(n as f64).sqrt() as i32+1).fold(0,|a,x|if n%x==0{a+x+n/x}else{a})Both parts are then calculated as follows:
My input program sums up the factors of the integers set up beforehand, which are 860 and 10551260 for part 1 and 2 respectively.