MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: extract from list and keep track

  • To: mathgroup at smc.vnet.net
  • Subject: [mg62157] Re: [mg62131] extract from list and keep track
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sun, 13 Nov 2005 02:08:36 -0500 (EST)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

data1={3,7,9,21,43,57,63,71,75,99};

r=Range[Length[data1]];

sel1=Select[Thread[{r,data1}],
    Mod[#[[2]],8]==1||Mod[#[[2]],8]==7&]

{{2, 7}, {3, 9}, {6, 57}, {7, 63}, {8, 71}}

data2=data1[[#]]&/@Complement[r,sel1[[All,1]]]

{3, 21, 43, 75, 99}


Bob Hanlon

> 
> From: Andrea <andrea at radargift.com>
To: mathgroup at smc.vnet.net
> Date: 2005/11/12 Sat AM 03:31:47 EST
> Subject: [mg62157] [mg62131] extract from list and keep track
> 
> I'm trying to write a program for the following. Seems simple, but I'm 
> unable to to do it:
> 
> I have a list of increasing odd numbers. I want to create a table that 
> indicates which numbers in this list are 1(mod 8) and 7(mod 8) and what 
> position in the list these numbers have.
> Then I would like to have them removed form the list to get a new 
(reduced) 
> list.
> 
> 
> Example: 3, 7, 9, 21, 43, 57, 63, 71, 75, 99.   I want to form this a Table:
> 
> 2      7
> 3      9
> 6    57
> 7    63
> 8    71
> 
> 7 is 7(mod 8) and is the 2nd member in the list, 9 is 1(mod 8) and is the 
> 3rd member in the list, etc.
> 
> The next list would become, having removed the ones in the table:
> 
> 3, 21, 43, 75, 99
> 
> And I would be using some other congruence criteria. Etc.
> 
> Thanks,
> Andrea
> 
> 


  • Prev by Date: Re: extract from list and keep track
  • Next by Date: Re: Tilting at Windmills?
  • Previous by thread: Re: extract from list and keep track
  • Next by thread: Re: extract from list and keep track