Last active
December 9, 2021 11:20
-
-
Save ap29600/4a2ecf5507063637b50d532da890a40f to your computer and use it in GitHub Desktop.
A solution for Advent of Code 2021 day 6 that comfortably fits in a tweet (matlab)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = sum(load("in.txt")(:) == [0:8])'; | |
A = diag(ones(1, 8), 1); | |
A(9, 1) = 1; | |
A(7, 1) = 1; | |
format rat | |
sum(A^80*x) | |
sum(A^256*x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment