MathGroup Archive 2011

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

Search the Archive

Re: Help with Delete cases

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116232] Re: Help with Delete cases
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Tue, 8 Feb 2011 05:03:42 -0500 (EST)
  • References: <iiojml$gip$1@smc.vnet.net>

You can use PatternTest (abbreviated as ?) to add a logical test to a
pattern.

You pattern is not really clear to me. You don't specify what your n
and m are supposed to be, but assuming that m is the number in the
table and p and n (don't use a capital N !) are provided somewhere
else the following would work:

n=0;
p=10;
DeleteCases[list, _?(Mod[# (# + 1)/2, p] == n &)]

Cheers -- Sjoerd

On Feb 7, 12:05 pm, KenR <ramsey2... at msn.com> wrote:
> I have a list= Range[3003]  I want to delete cases of n = m(m+1) mod P
> from the list, but Delete cases only deletes cases matching a pattern,
> i.e.
>
> list = DeleteCases[list,Mod[N - m(m+1)/2,P] = 0] will definitely not
> work.  I want to keep list, as the same identifier, throughout since
> this is within a looping process. Any suggestions?



  • Prev by Date: Re: Help with Delete cases
  • Next by Date: Generated parameters
  • Previous by thread: Re: Help with Delete cases
  • Next by thread: Re: Help with Delete cases