Skip to content

Instantly share code, notes, and snippets.

@ap29600
Last active December 9, 2021 11:20
Show Gist options
  • Save ap29600/4a2ecf5507063637b50d532da890a40f to your computer and use it in GitHub Desktop.
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)
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