What is the average length of longest substring occurring at more than one position in a uniformly random binary string S of length N ?
For example,
n answer
1 0/2
2 2/4
3 10/8
4 26/16
For n=4
0000 3
0001 2
0010 1
0011 1
0100 1
0101 2
0110 1
0111 2
1000 2
1001 1
1010 2
1011 1
1100 1
1101 1
1110 2
1111 3
-------
26
Generalized version: in stead of a binary string, S is a uniformly random string of length N with alphabet of size M.