Please Help Simplify This

*To*: mathgroup at smc.vnet.net*Subject*: [mg29023] Please Help Simplify This*From*: Flip <nospam at newsranger.com>*Date*: Fri, 25 May 2001 01:47:59 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Hi All (sorry for the large number of posts), I would like to move the qq to be inside of the module so that it stops once the conditional is satisfied. Can someone please help? Pfind[ a_, b_, y_, c_, v_] := Module[{q = c, p1 = a, p2 = b, y0 = y, w = Length[c], i = 1, e = v}, For[i = 1, i < w + 1, i++, If[(Mod[q[[i]] - 1, p1] == 0 && Mod[q[[i]] + 1, p2] == 0 && PrimeQ[q[[i]]] == True && GCD[e, q[[i]] - 1] == 1), Print[{i, q[[i]]}]]]] qq = Table[Y0 + i(p1 p2), {i, 1, 1700}]; e = 3; Pfind[ p1, p2, Y0, qq, e ] See how I must keep generating qq's and then test them? I would like Pfind to just keep searching for p until all of the conditions are met. Instead of passing the vector qq, I would only pass Y0. Any thoughts? Thank you ... Flip