OFFSET
1,1
COMMENTS
This is almost certainly the complete list of Barker codes.
Codes of the same length which also have similar autocorrelation function are considered as the same and only one code which has greatest value is stored. For example: for codes of length 5 in binary representation: 00010, 01000, 10111 and 11101 only one code 11101 (29 in decimal) should be stored. - Sergiy Piyatakov, Jan 13 2017
LINKS
Eric Weisstein's World of Mathematics, Barker Code
EXAMPLE
29 (binary: 11101) is in the sequence because + + + - + is a Barker code.
PROG
(Python)
def ok(n):
t = [(-1)**int(x) for x in bin(n)[2:]]
return all(abs(sum(t[i]*t[i+k] for i in range(len(t)-k))) <= 1 for k in range(1, len(t)))
def not_dup(n):
b = bin(n)[2:]
i = ''.join('0' if c=='1' else '1' for c in b)
return b >= b[::-1] and b >= i[::-1]
a = [n for n in range(2, 2**13) if not_dup(n) and ok(n)]
print(a)
# Andrey Zabolotskiy, Jan 13 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Gordon Hamilton, Sep 13 2016
EXTENSIONS
Corrected by Sergiy Piyatakov, Jan 13 2017
STATUS
approved