login
Starting index in the Period doubling sequence (A096268) of the first maximum length word in which every subword of length n is distinct.
1

%I #31 Dec 19 2024 11:46:20

%S 0,0,1,0,5,2,1,0,11,10,9,4,3,2,1,0,23,22,21,20,19,18,17,8,7,6,5,4,3,2,

%T 1,0,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,16,15,14,13,12,11,

%U 10,9,8,7,6,5,4,3,2,1,0,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81,80

%N Starting index in the Period doubling sequence (A096268) of the first maximum length word in which every subword of length n is distinct.

%C a(2^m)=0; i.e. for all nonnegative integers m, the longest words w with no length-(2^m) subwords of w repeated are the prefixes of length A366462(2^m) of the Period doubling sequence.

%H Kevin Ryde, <a href="/A367184/b367184.txt">Table of n, a(n) for n = 1..8192</a>

%H Kevin Ryde, <a href="/A367184/a367184.gp.txt">PARI/GP Code</a>

%e For n=3, the first instance of one of the longest words w in A096268 with no repeated subwords of length 3 is w=1000101 which begins at index 1, so a(3)=1. The length of w is A366462(3) = 7.

%o (Walnut)

%o def pdfaceq "At (t<n) => PD[i+t]=PD[j+t]"; % Check if two length-n factors of Period doubling sequence at positions i and j are equal; PD is predefined in Walnut as the DFA that recognises the Period doubling sequence. %

%o def pd_w_len_N_unique_factors "Aj, k (i<=j & j<(i+n-N) & j<k & k<(i+n-N+1)) => ~$pdfaceq(j, k, N)": % Find lengths and positions of words with length-N unique factors; must replace N with a constant %

%o def pd_longest_len_N "$pd_w_len_N_unique_factors(i,n) & Am (m>n) => ~$pd_w_len_N_unique_factors(i,m)"; % Check the longest of the lengths of words defined in the line above; must replace N with the same constant %

%o def pd_longest_len_N_fpos "$pd_longest_len_N(i,M) & Aj (j<i) => ~$pd_longest_len_N(j,M)"; % This finds the first positions of the longest words required; must replace M with A366462(N).%

%o (PARI) \\ See links.

%Y Cf. A096268, A366462 (length of the longest word), A275202 (subword complexity).

%K nonn

%O 1,5

%A _Gandhar Joshi_, Nov 08 2023