Re: Help with Delete cases
- To: mathgroup at smc.vnet.net
- Subject: [mg116240] Re: Help with Delete cases
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Tue, 8 Feb 2011 05:05:11 -0500 (EST)
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