aboutsummaryrefslogtreecommitdiff
path: root/2017/02/puzzle-2.awk
blob: 7cfd91d075096e0a5905c1c6c5eb025715b7482e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env -S awk -f

{
	for (i = 1; i <= NF; i++) {
		for (j = 1; j <= NF; j++) {
			if (i != j && $i % $j == 0) {
				acc += $i / $j
				next
			}
		}
	}
}

END { print acc }