Skip to content

Instantly share code, notes, and snippets.

@tommyip
Created December 28, 2020 04:35
Show Gist options
  • Save tommyip/2edf7f8a317f670667b0ec6f1330555b to your computer and use it in GitHub Desktop.
Save tommyip/2edf7f8a317f670667b0ec6f1330555b to your computer and use it in GitHub Desktop.
AoC2020 Day 13 Dyalog APL solution from @jayfoad
Credit: @jayfoad (https://github.com/jayfoad/aoc2020apl/blob/main/p13.dyalog)
⎕IO0
ap⎕NGET'p13.txt'1
d¨bc(,'x')¨b'\w+'⎕S'&'p
{()d×}d|-a part 1
⎕PP17 ⎕FR1287
gcd{=0: 1 0 g s t| g t(s-t×÷)}
crt{z÷m×/ m|+/×z×1¨z gcd¨}
(-c)crt d part 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment