# [seqfan] Puzzle (WAS: Partitioning the sequence)

zak seidov zakseidov at yahoo.com
Mon Dec 22 18:56:13 CET 2008

```27,53,73,157,163,173,177,181,233,235,239,241,
277,289,319,335,337,357,363,409,415,417,419,
421,477,519,531,533,547,613,677,691,701,723,
733,747,757,771,827,877,881,893,973

Puzzle (WAS: Partitioning the sequence)

This sequence is apparently infinite (no proof...),
terms (full up to 10^3 ) are obtained with using the (great!) Mathematica code by Olivier Gerard
(i readily admit that i couldn't understand the code BUT IT WORKS!).
Also thanks a lot to Leroy and Franklin  for their prompt and illuminative responces.
Hope that sequence is interesting &
hope i could submit it after some responces.
Happy Near Year 2009!
thx, zak

--- On Mon, 12/22/08, Olivier Gerard <olivier.gerard at gmail.com> wrote:

> From: Olivier Gerard <olivier.gerard at gmail.com>
> Subject: [seqfan] Re: Partitioning the sequence (?)
> To: "Sequence Fanatics Discussion list" <seqfan at list.seqfan.eu>
> Date: Monday, December 22, 2008, 2:19 AM
> Dear Zak,
>
> You asked for some Mathematica code.
> There is of course the Combinatorica standard package but
>
> So here is a way (probably not the more concise)
> to do it with classic primitives of Mathematica,
> starting with 0s and 1s as suggested by other
> members:
>
> With[{n = 6, baselist = {a, b, c, d, e, f}},
>   Map[ Take[baselist, #] &,
>     Map[ Rest at FoldList[Last[#1] + {1, #2} &, {0, 0}, #]
> &, Map[Length,
>         Map[Split, Table[IntegerDigits[i, 2, n], {i, 0,
> 2^(n - 1) -
>                 1}]], {2}]
>       ], {2}]
>   ]
>
> Here n is what you called L, and of course the number
> of variants is  2^(n-1), if all the element of the original
> list
> are differents.
>
> Be aware that there several ways to order the compositions
> in sublists of a list. My code may not give you what you
> intended.
>
> If you need to explore a large set, you will also need a
> way to
> generate such a decomposition one at a time (so that you
> don't
> have to store all results at once).
>
> You can do so from this code, by taking the innermost loop
> out.
>
> Regards,
>
> Olivier
>
>
> On Sun, Dec 21, 2008 at 21:38, zak seidov
> <zakseidov at yahoo.com> wrote:
> > Dear SeqFans,
> >
> > I need to part the sequence a,b,c,d...(of length L)
> > in all, n, possible ways:
> >
> >
> > in this case L=4 and n=8 (modulo my errs).
> >
> > My (humble) Qs:
> > what is the function n(L) (guess that this is known
> one...)
> > how to code this in Mathematica/PARI/Maple (in order
> of decreasing preference)
> >

```