Problem 265
Binary Circles
2N binary digits can be placed in a circle so that all the N-digit clockwise subsequences are distinct.
For N=3, two such circular arrangements are possible, ignoring rotations:
For the first arrangement, the 3-digit subsequences, in clockwise order, are: 000, 001, 010, 101, 011, 111, 110 and 100.
Each circular arrangement can be encoded as a number by concatenating the binary digits starting with the subsequence of all zeros as the most significant bits and proceeding clockwise. The two arrangements for N=3 are thus represented as 23 and 29:
Calling S(N) the sum of the unique numeric representations, we can see that S(3) = 23 + 29 = 52.
Find S(5).
二进制圈
2N个二进制位可以排成一圈,使得所有按顺时针顺序得到的N位二进制子串都不一样。
对于N=3,不考虑旋转,有两种可行的排圈方式:
在第一种排圈方式中,按顺时针顺序得到的3位二进制子串分别是:000、001、010、101、011、111、110和100。
每一种排圈方式都可以按如下方式编码:以全为0的子串作为起点,将所有的二进制位连接起来。N=3的两种排圈方式于是就可以编码为23和29:
记S(N)是所有排圈方式的编码之和,我们可以看到S(3) = 23 + 29 = 52。
求S(5)。