MathGroup Archive 2011

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

Search the Archive

Re: Help with Delete cases


Your question is vague about m and P, but here's a possibility:

list = Range@3003;
p = 13;

3003

eliminate = Union@Array[Mod[# (# + 1), p] &, {p + 1}]

{0, 2, 3, 4, 6, 7, 12}

Select[list, ! MemberQ[eliminate, Mod[#, p]] &];
Length@%

1386

or this:

keep = Complement[Range[0, p - 1], eliminate]

{1, 5, 8, 9, 10, 11}

Pick[list, Mod[list, p], Alternatives @@ keep];
Length@%

1386

Bobby

On Mon, 07 Feb 2011 05:06:03 -0600, KenR <ramsey2879 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?
>


-- 
DrMajorBob at yahoo.com


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