# [seqfan] Re: help needed with former sequence A138036 (N. J. A. Sloane)

Ed Jeffery ed.jeffery at yahoo.com
Mon Sep 5 02:40:25 CEST 2011

```
Seqfans,

If it is true that all terms from the former A138036 are from the set {0,1,2}, then a similar sequence arises as follows. Let S={0,1,2}. For n=0,1,2,..., consider the set Y_n of lexicographically-ordered sets of n-tuples of elements from S. For example, for n=3,

Y_3={{0,0,0},{0,0,1},{0,0,2},{0,1,0},{0,1,1},{0,1,2},{0,2,0},{0,2,1},{0,2,2},{1,0,0},{1,0,1},{1,0,2},{1,1,0},{1,1,1},{1,1,2},{1,2,0},{1,2,1},{1,2,2},{2,0,0},{2,0,1},{2,0,2},{2,1,0},{2,1,1},{2,1,2},{2,2,0},{2,2,1},{2,2,2}}.

Let X_n be the lexicographically-ordered set derived from Y_n by elimination of any n-tuples that contain any adjacent, identical subsequences of terms, e.g., for n=5, both {1,1,2,0,1} and {1,2,1,2,0} (among others) would be eliminated; and for n=9, {0,1,2,0,1,2,0,1,2} would be a 9-tuple that is eliminated.

For example, for n=3, the elements

{0,0,0},{0,0,1},{0,0,2},{0,1,1},{0,2,2},{1,0,0},{1,1,0},{1,1,1},{1,1,2},{1,2,2},{2,0,0},{2,1,1},{2,2,0},{2,2,1} and {2,2,2}

are all eliminated from Y_3 leaving us with

X_3={{0,1,0},{0,1,2},{0,2,0},{0,2,1},{1,0,1},{1,0,2},{1,2,0},{1,2,1},{2,0,1},{2,0,2},{2,1,0},{2,1,2}}.

It seems that this procedure gives the partial sequence given by Neil, although I'm not sure about the case for n=0, nor for the cases for n>5 since they weren't given previously. Whether or not this gives the intended former sequence A138036 is another question since no definition was given.

Finally, it is interesting to take each n-tuple as coefficients {a_0,...,a_n} and write down the resulting sequence of numbers of the form a_0*x^n+...+a_(n-1)*x+a_n, for x>0 an integer: the sequences for x>2 seem to be increasing and probably admit arrays that aren't in the OEIS database, and other interesting forms are with the above polynomials in x_n where x_n=n, etc..

>Dear Seqfans, I admit I don't speak Mathematica.
>Here is the definition of the former sequence A138036
>(now deleted from the OEIS, but you can read the History):

>Clear[a];
a = With[{n = 8, k = 3}, NestList[DeleteCases[Flatten[Map[Table[Append[
#, i - 1], {i, k}] &, # ], 1], {___, u__, v__} /; Sort[{u}] ==
Sort[{v}]] &, {{}}, n]]; Flatten[a]

>which apparently produces

>{{}},
>{{0}, {1}, {2}},
>{{0, 1}, {0, 2}, {1, 0}, {1, 2}, {2, 0}, {2, 1}},
>{{0,
1, 0}, {0, 1, 2}, {0, 2, 0}, {0, 2, 1}, {1, 0, 1}, {1, 0, 2}, {1, 2,
0}, {1, 2, 1}, {2, 0, 1}, {2, 0, 2}, {2, 1, 0}, {2, 1, 2}},
>{{0, 1,0,
2}, {0, 1, 2, 0}, {0, 1, 2, 1}, {0, 2, 0, 1}, {0, 2, 1, 0}, {0, 2, 1,
2}, {1, 0, 1, 2}, {1, 0, 2, 0}, {1, 0, 2, 1}, {1, 2, 0, 1}, {1, 2, 0,
2}, {1, 2, 1, 0}, {2, 0, 1, 0}, {2, 0, 1, 2}, {2, 0, 2, 1}, {2, 1, 0,
1}, {2, 1, 0, 2}, {2, 1, 2, 0}},
>{{0, 1, 0, 2, 0}, {0, 1, 0, 2, 1},
{0, 1, 2, 0, 1}, {0, 1, 2, 0, 2}, {0, 1, 2, 1, 0}, {0, 2, 0,1, 0}, {0,
2, 0, 1, 2}, {0, 2, 1, 0, 1}, {0, 2, 1, 0,2}, {0, 2, 1, 2, 0}, {1, 0,1,
2, 0}, {1, 0, 1, 2, 1}, {1, 0, 2, 0, 1}, {1, 0, 2, 1, 0}, {1, 0, 2, 1,
2}, {1, 2, 0, 1, 0}, {1, 2, 0, 1, 2}, {1, 2, 0, 2, 1}, {1, 2, 1, 0, 1},
{1, 2, 1, 0, 2}, {2, 0,1, 0, 2}, {2, 0, 1, 2, 0}, {2, 0, 1, 2, 1}, {2,
0, 2,1, 0}, {2, 0, 2, 1, 2}, {2,1, 0, 1, 2}, {2, 1, 0, 2, 0}, {2, 1, 0,
2, 1}, {2, 1, 2, 0, 1}, {2, 1, 2, 0, 2}},
...

>which then became the sequence

>0,
1, 2, 0, 1, 0, 2, 1, 0, 1, 2, 2, 0, 2, 1, 0, 1, 0, 0, 1, 2, 0, 2, 0, 0,
2, 1, 1, 0, 1, 1, 0, 2, 1, 2, 0, 1, 2, 1, 2, 0, 1, 2, 0, 2, 2, 1, 0, 2,
1, 2, 0, 1, 0, 2, 0, 1, 2, 0, 0, 1, 2, 1, 0, 2, 0, 1, 0, 2, 1, 0, 0, 2,
1, 2, 1, 0, 1, 2, 1, 0, 2, 0, 1, 0, 2, 1, 1, 2, 0, 1, 1, 2, 0, 2, 1, 2,
1, 0, 2, 0, 1, 0, 2, 0, ...

>which was A138036

>which was recently deleted by the editors.

>But the sequence looks interesting. Can anyone supply a definition
>in English for it? Or is it indeed not worthy of being included?

>Thanks

>Neil
```