function p=period2(x,k)
%declares a period if k elements in a row match in the sequence x
n=length(x);
j=11;
while (sum(x(10:10+k)==x(j:j+k))<k+1)
    j=j+1;
end
p=j-10;
    