Re: extract from list and keep track
- To: mathgroup at smc.vnet.net
- Subject: [mg62174] Re: [mg62131] extract from list and keep track
- From: <bsyehuda at gmail.com>
- Date: Sun, 13 Nov 2005 21:16:11 -0500 (EST)
- References: <200511120831.DAA19138@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, It seems that you describe your needs in terms of a procedural programming language and telling exactly what you need to do. You need to remove all occurrences of numbers which are 1(mod 8) or 7(mod 8). (saying that you want to Keep all the remaining) Two immediate and rather simple solutions will give you the result you need l={3, 7, 9, 21, 43, 57, 63, 71, 75, 99}; Select[l, (Mod[#, 8] ≠ 1 && Mod[#, 8] ≠ 7) &] or Cases[l, x_ /; Mod[x, 8] ≠ 1 && Mod[x, 8] ≠ 7] Good luck yehuda On 11/12/05, Andrea <andrea at radargift.com> wrote: > > 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 > >
- References:
- extract from list and keep track
- From: Andrea <andrea@radargift.com>
- extract from list and keep track