fork download
  1. for n in {1..20}; do
  2. printf "%d %d\n" $n $(perl -pe'$a.=/(.*)(.)\1$/^$2for($a)x$_;$_=$a%5+1' <<< $n)
  3. done
Success #stdin #stdout 0s 5992KB
stdin
Standard input is empty
stdout
1 1
2 2
3 1
4 1
5 2
6 2
7 1
8 2
9 1
10 1
11 2
12 1
13 2
14 2
15 1
16 1
17 2
18 1
19 1
20 1