%I #19 Jan 10 2017 20:05:26
%S 1,0,1,1,1,0,0,0,1,0,1,1,1,1,1,1,0,1,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0,0,
%T 0,0,0,0,1,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,
%U 0,0,1,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,1,0,1,0,1,0,0,1,0,1,1,0,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1
%N A pseudorandom binary sequence with minimum cyclic autocorrelation of all of its partial subsequences.
%C After the first term a(1) = 1, each subsequent term is chosen so as to minimize the cyclic autocorrelations of the partial sequence. If the autocorrelation doesn't change with different choices for the next term, then the complement of the previous term is used. If this sequence were to repeat the last term instead of using its complement, a similar result would be obtained, that is, a sequence with a nearly flat average Fourier spectrum, but with half the average power spectrum.
%F With F(a(n)) = Sum_{i=1..n} Sum_{j=0..n-1} (2*a(i)-1)*(2*a((i+j) mod n)-1)
%F If argmin(F(a(n))) < argmax(F(a(n))) then
%F a(n) = argmin(F(a(n)))
%F else
%F a(n) = (a(n-1) + 1) mod 2
%t (* This function is the sum of all possible cyclic autocorrelations of a list x *)
%t AutoCorrelation[x_] :=
%t Sum[Abs[x.RotateRight[x, j]], {j, 0, Length[x] - 1}];
%t a = {1};(* First element *)
%t nmax = 120;(*number of appended elements*)
%t Do[If[AutoCorrelation[Append[a, 1]] < AutoCorrelation[Append[a, -1]],
%t AppendTo[a, 1],
%t If[AutoCorrelation[Append[a, 1]] > AutoCorrelation[Append[a, -1]],
%t AppendTo[a, -1], AppendTo[a, -a[[-1]]]]], {j, nmax}];
%t a /. {-1 -> 0}
%K nonn,base
%O 1,1
%A _Andres Cicuttin_, Jan 07 2017