can anyone help me with the math on today's #adventofcode (https://adventofcode.com/2017/day/3)? I feel like I can kinda see the pattern but I don't know enough Math to actually rigorously describe it

@diamaterialista The dingus in part 1 at least is an Ulam's spiral - it's tweaked in part 2. Clever solutions for part 1 skip the grid generating stuff, but that fucks you up on part 2. The distance algorithm in part 1 doesn't need pathfinding at all if you're being naïve and make a whole grid; you can just use some simple subtraction there.

@calvin ah, so I should actually generate the whole grid? I just kinda took it as a given that that would be a Memory Nightmare for a sufficiently large input :p

@diamaterialista it's actually not; you're likelier to create int overflows on part 2.

Doing it without a grid (and doing it In a FUNCPROG way) gets you style and flair points though, which don't really exist, but are really cool to flaunt anyways.

❤️☭ Kinsey ☭❤️@diamaterialista@cybre.spaceAoC2017 Day 3 spoilers Show more

@calvin ah, so I should actually generate the whole grid? I just kinda took it as a given that that would be a Memory Nightmare for a sufficiently large input :p