SHARE
TWEET

ralu

a guest Jun 17th, 2009 320 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. << "Algebra`PolynomialPowerMod`"
  2. << "FiniteFields`"
  3.  
  4. n = 10; p = 5;
  5. r = (p^n - 1)/(p - 1);
  6. fac = FactorInteger[r];
  7. factor[i_] := fac[[i]][[1]];
  8. facnum = Length[fac];
  9. j = 0;
  10. m[i_] := r/factor[i];
  11.  
  12.  
  13. While[j < 1000, j = j + 1;
  14.   coef = Prepend[
  15.     Append[Table[RandomInteger[{0, p - 1}], {i, n - 1}], 1],
  16.     RandomInteger[{1, p - 1}]];
  17.   poly = Total[Table[coef[[i]] x^(i - 1), {i, 1, n + 1}]];
  18.   If[MultiplicativeOrder[(-1)^n coef[[1]], p1] == p - 1, Continue[];];
  19.    If[MemberQ[Table[Mod[poly, p] /.x -> i, {i, 1, p - 1}], 0],
  20.    Continue[];];
  21.   Qrows = Table[PolynomialPowerMod[x, p k, {poly, p}], {k, 0, n - 1}];
  22.    Pd[x_] := PadRight[x, n]; Q = Pd /@ CoefficientList[Qrows, x];
  23.   QI = Q - IdentityMatrix[n];
  24.   ns = NullSpace[Transpose[QI], Modulus -> p];
  25.   If[Dimensions[ns][[1]] != 1, Continue[];];
  26.   If[PolynomialGCD[poly, \!\(
  27. \*SubscriptBox[\(\[PartialD]\), \(x\)]poly\), Modulus -> p] != 1,
  28.    Continue[];]; a = PolynomialPowerMod[x, r, {poly, p}];
  29.   If[IntegerQ[a] == False, Continue[];];
  30.   If[Mod[(-1)^n coef[[1]] - a, p] != 0, Continue[];];
  31.   For[i = 2, i <= facnum,
  32.    If[IntegerQ[PolynomialPowerMod[x, 80, {poly, p}]], Continue[];];
  33.    i++]; Print[j]; Print[coef]; Print[poly];
  34.   Break[];];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top