A276638 a(0)=0; thereafter a(n) is the number of matches between the first n terms circularly shifted by s and the reverse of the first n terms, maximized over s.
0, 1, 2, 1, 4, 3, 4, 3, 6, 3, 6, 3, 8, 5, 8, 5, 6, 5, 6, 7, 8, 7, 10, 7, 8, 7, 12, 7, 12, 7, 12, 7, 12, 7, 14, 9, 14, 9, 14, 9, 14, 9, 14, 9, 14, 11, 16, 11, 14, 11, 16, 11, 18, 11, 16, 11, 16, 11, 16, 11, 20, 13, 16, 13, 18, 13, 16, 13, 18, 13, 18, 13, 18
Offset: 0
Examples
The first 6 terms (0, 1, 2, 1, 4, 3) shifted by 5 to the left yield (3, 0, 1, 2, 1, 4), which coincides with the first 6 terms reversed (3, 4, 1, 2, 1, 0) at 4 positions, and no shift produces more matches than 4, thus a(6)=4.
Links
- Andrey Zabolotskiy, Table of n, a(n) for n = 0..9999
Crossrefs
Cf. A272727.
Programs
-
Mathematica
a = {0}; Do[AppendTo[a, Max@ Map[Count[Transpose@ #, w_ /; Equal @@ w] &, Array[{RotateLeft[a, #], Reverse@ a} &, n]]], {n, 72}]; a (* Michael De Vlieger, Sep 13 2016 *)
-
Python
a = [0] for n in range(1, 100): a.append(max(sum(a[(i+s)%n]==a[-i-1] for i in range(n)) for s in range(n)))
Comments