Re: position of sequence of numbers in list
- To: mathgroup at smc.vnet.net
- Subject: [mg107005] Re: [mg106976] position of sequence of numbers in list
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 31 Jan 2010 05:58:00 -0500 (EST)
- Reply-to: hanlonr at cox.net
Position[list, Sequence[3, 4]] Bob Hanlon ---- JB <jkerrb at gmail.com> 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