Re: position of sequence of numbers in list

• To: mathgroup at smc.vnet.net
• Subject: [mg106993] Re: [mg106976] position of sequence of numbers in list
• From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
• Date: Sun, 31 Jan 2010 05:55:49 -0500 (EST)
• References: <201001301212.HAA25132@smc.vnet.net>

```Hi,

I assume the only thing you miss is how to express a "sequence of
numbers"? Just use Sequence[] :-)

list=Range[20];
Position[list, Sequence[11, 12, 13]]

Cheers
Patrick

On Sat, 2010-01-30 at 07:12 -0500, JB wrote:
> Hi,
>
> What is the most efficient way to find the position of the beginning
> of a sequence of numbers from a list?
>
> I found a couple of ways:
>
> find 3,4 in list={1,2,3,4,5};
>
>  1.   pos=Intersection[Position[list,3],(Position[list,4])+1]
>
>  2.   pos=Position[Partition[list,2,1],{3,4}]
>
> Are there other ways to do this?
> What is the best way when dealing with large lists?
>
> Thanks,
> JB
>

```

• Prev by Date: Re: Numerical Problem
• Next by Date: Coloring a Sum
• Previous by thread: position of sequence of numbers in list
• Next by thread: Re: position of sequence of numbers in list