[seqfan] Re: help needed with former sequence A138036

wouter meeussen wouter.meeussen at pandora.be
Sun Sep 4 12:51:55 CEST 2011


dear Neil and colleagues,

if I take the Mma program apart, step by step,
then I'm under the (strong) impression that the author did not aim for a
specific program performance.
I say this because it is quite obscure what the effect of the "DeleteCases"
is during program execution.

it goes like this:
step 1: with k set to 3 and n to 3 for clarity:
NestList[Flatten[Map[Table[Append[ #, i - 1], {i, 2}] &, # ], 1] &, {{}},
3]//ColumnForm
{
{{}},
{{0}, {1}, {2}},
{{0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {1, 2}, {2, 0}, {2, 1}, {2, 2}},
{{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}}
}

this reads:
take a list of items one by one, starting with the empty list
and replace each element with multiple copies by appending a counter 1..k to
it.
and iterate this procedure n times.

This procedure would produce (k=3) , after flattening out
{0, 1, 2, 0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 1, 2, 2, 0, 2, 1, 2, 2, 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}
and this would be the start for any n>=3.

So far, so dull, so good.
But then, the DeleteCases creates what could be called 'turbulence' in this.

try to follow what gets deleted at each step:
NestList[ReplaceAll[Flatten[Map[Table[Append[ #  , i - 1], {i, 3}] &, # //.
del[__]->Sequence[]], 1], {qq___, u__, v__} /; Sort[{u }] == Sort[{v}] ->
del[{qq,u,v}]] &, {{}}, 3]//ColumnForm

{
{{}},
{{0}, {1}, {2}},
{del[{0, 0}], {0, 1}, {0, 2}, {1, 0}, del[{1, 1}], {1, 2}, {2, 0}, {2, 1},
del[{2, 2}]},
{{0, 1, 0},  del[{0, 1, 1}], {0, 1, 2}, {0, 2, 0}, {0, 2, 1}, del[{0, 2,
2}], del[{1, 0, 0}], {1, 0, 1}, {1, 0, 2}, {1, 2, 0}, {1, 2, 1}, del[{1, 2,
2}], del[{2, 0, 0}], {2, 0, 1}, {2, 0, 2}, {2, 1, 0}, del[{2, 1, 1}], {2, 1,
2}}
}

any sublist ending with two identical *parts after sorting* is deleted. Fair
enough.
But the identical sorted parts can be any length, and are based on *previous
deletions*
(actually maximal length if multiple fits occur).
No human can get its mind around this for more than a few steps.

If this sequence is not inspired by a game or real-life decimation
procedure,
then I view it as chaotic and 'content-free'.

I concur with its deletion & recycling.

Wouter.

----- Original Message ----- 
From: "N. J. A. Sloane" <njas at research.att.com>
To: <seqfan at seqfan.eu>
Cc: <njas at research.att.com>
Sent: Sunday, September 04, 2011 11:19 AM
Subject: [seqfan] help needed with former sequence A138036


> 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
>
> ...
>
> which then became the sequence
>
, ...
>
> 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
>




More information about the SeqFan mailing list