The longest string of none consecutive repeated pattern Construct a string by using only $n$ characters, the string should do not contain any consecutive repeated pattern, in other words, the string must have not any substring matching /(.+)\1/, what is the length l(n) of the longest string S(n)?

n    S(n)    l(n)
1    a       1
2    aba     3
3    ?       ?
4    ?       ?




Edit:
abcabacbabcabacabcac has none consecutive  repeated pattern,so l(3)&gt;=20
A theorem of Thue's (not Thue's theorem!) states that for $n = 3$ (and therefore, also for larger $n$) an infinite sequence of characters (chosen out of $n$) without repeated sub-sequences (a.k.a square-free) exists. 

Edit: here's a slightly related reference: J.D. Currie's paper 'There are ternary circular square-free words of length
n for n  18.', which at least has a reference to Thue's paper from 1906. 

Edit 2: Another reference, with explicit construction of sequences of length 3, 9, 27 and so on: http://arxiv.org/abs/0712.0139. 
That paper gives the following sequence of length 27: 123213231213123132312132123
To find a maximal string for n letters, add a new letter in every other place of a maximal string for n-1 letters.  It is still the case that no consecutive identical substrings exist.  No more letters can be added because two of them would have to appear consecutively, so this is the best that is possible.  The length of the string is 2^n-1.

a
bab
cbcacbc
dcdbdcdadcdbdcd