Re: How to do quickest
- To: mathgroup at smc.vnet.net
- Subject: [mg116456] Re: How to do quickest
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Wed, 16 Feb 2011 04:34:14 -0500 (EST)
- References: <ijdo9g$f8a$1@smc.vnet.net>
On 15/02/2011 11:33, Artur wrote:
> Dear Mathematica Gurus,
> How to do following procedure quickest?
> (*start*)
> pol = x^8 - x - 1; nn = Length[CoefficientList[pol, x]] - 1; If[
> IrreduciblePolynomialQ[pol], pp = IntegerPartitions[nn]; aa = {};
> Do[AppendTo[aa, {}], {n, 1, Length[pp]}]; Print[aa];
> ff = FactorInteger[Discriminant[pol, x]]; bb = {};
> Do[AppendTo[bb, ff[[n]][[1]]], {n, 1, Length[ff]}]; n = 1; cn = 0;
> While[cn< nn!, p = Prime[n];
> If[MemberQ[bb, p], , cn = cn + 1;
> kk = FactorList[pol, Modulus -> p]; ww = {};
> Do[cc = Length[CoefficientList[kk[[m]][[1]], x]];
> AppendTo[ww, cc - 1], {m, 2, Length[kk]}]; ww = Reverse[ww];
> pos = Position[pp, ww][[1]][[1]]; AppendTo[aa[[pos]], Prime[n]]];
> n++]]; Table[Length[aa[[m]]], {m, 1, Length[aa]}]
> (*end*)
> Best wishes
> Artur
>
It might be better to describe what you want Mathematica to do, rather
than leave people to decipher the code you have written!
David Bailey
http://www.dbaileyconsultancy.co.uk