OFFSET
1,2
COMMENTS
It is unclear how a(n) is defined for n >= 10.
LINKS
P. J. Koutas and T. C. Hu, Shortest String Containing All Permutations, Discrete Mathematics, Vol. 11, 1975, pp. 125-132.
S.P. Mohanty, Shortest string containing all permutations, Discrete Mathematics, Volume 31, Issue 1, 1980, Pages 91-95.
MATHEMATICA
NextTuple[x_, n_, l_] := Module[{i, x0 = x},
If[x0 == ConstantArray[n, l], Return[{}]];
For[i = l, i >= 1, i--,
If[x0[[i]] < n, x0[[i]]++; Return[x0], x0[[i]] = 1]]];
Join[{1}, Table[p = Permutations[Range[n], {n}];
For[tl = n + 1, tl <= 50, tl++,
tup = ConstantArray[1, tl];
While[tup = NextTuple[tup, n, tl]; tup != {},
If[Product[Count[tup, i], {i, 1, n}] == 0, Continue[]];
For[j = 1, j <= Length[p], j++,
perm = p[[j]]; lst = tup; fnd = True;
For[k = 1, k <= Length[perm], k++,
If[lst == {}, fnd = False; Break[]];
p1 = Position[lst, perm[[k]], 1, 1];
If[Length[p1] == 0, fnd = False; Break[]];
p1 = First@First@p1;
If[! IntegerQ[p1], fnd = False; Break[]];
lst = Drop[lst, p1];
]; If[! fnd, Break[]]]; If[fnd, Break[]]]; If[fnd, Break[]]];
FromDigits@tup, {n, 2, 5}]] (* Robert Price, Oct 13 2019 *)
CROSSREFS
KEYWORD
base,nonn,more,hard
AUTHOR
Aniruddha Das (hi.annie.pal(AT)gmail.com), May 10 2008
EXTENSIONS
Edited by N. J. A. Sloane, May 16 2008
a(4) corrected from 1234321234321 to 123412314213 by Bridget Tenner, Apr 21 2009, who also confirms a(1), a(2), a(3) and a(5).
a(3) and a(5) are corrected from A062714, incorrect terms a(6), a(7) are removed by Max Alekseyev, Apr 14 2013
a(3) corrected, a(6) added by Max Alekseyev, May 14 2013
a(7) added by Vitaliy Garnashevich, Mar 31 2017
a(8) added by Vitaliy Garnashevich, Jun 24 2020
STATUS
approved