diff options
-rw-r--r-- | 6np.py | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -3,7 +3,6 @@ from utils import open_day import numpy as np fish = Counter(map(int, open_day(6).read().split(','))) - fish = np.array([fish[i] for i in range(9)]) mat = np.array([ [0, 0, 0, 0, 0, 0, 1, 0, 1], @@ -17,7 +16,5 @@ mat = np.array([ [0, 0, 0, 0, 0, 0, 0, 1, 0] ]) -for i in range(256): - if i == 80: print(sum(fish)) - fish = np.matmul(fish, mat) -print(sum(fish)) +print(sum(np.matmul(fish, np.linalg.matrix_power(mat, 80)))) +print(sum(np.matmul(fish, np.linalg.matrix_power(mat, 256)))) |