day 8 part 2 finished
[aoc_eblake.git] / 2015 / advent25.sh
blob9e2795f60b39826ab5e57d08349500389300025d
1 row=${1-2978} col=${2-3083}
2 start=$((col*(col+1)/2))
3 echo "code sequence $start at row 1 column $col"
4 cell=$((start+(col-1)*(row-1)+(row-1)*row/2))
5 echo "code sequence $cell at row $row column $col"
6 i=1
7 code=20151125
8 while [[ $i -lt $cell ]]; do
9 : $((i++))
10 (( i % 10000 )) || echo " $i"
11 code=$((code * 252533 % 33554393))
12 done
13 echo "code at row $row column $col is $code"