home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e032 / 3.ddi / FILES / PROGRAMM.PAK / SWINNERT.M < prev    next >
Encoding:
Text File  |  1992-07-29  |  673 b   |  26 lines

  1.  
  2. (*********************************************************************
  3.  
  4.         Adapted from
  5.         Roman E. Maeder: Programming in Mathematica,
  6.         Second Edition, Addison-Wesley, 1991.
  7.  
  8.  *********************************************************************)
  9.  
  10.  
  11. SwinnertonDyerP::usage = "SwinnertonDyerP[n, var] gives the minimal polynomial
  12.     of the sum of the square roots of the first n primes."
  13.  
  14. Begin["`Private`"]
  15.  
  16. SwinnertonDyerP[n_Integer?Positive, x_] :=
  17.     Module[{arglist, poly},
  18.         arglist = Outer[Times, Sqrt[Prime[Range[n]]], {-1, 1}];
  19.         poly = Outer[Plus, {x}, Sequence @@ arglist];
  20.         Expand[Times @@ Flatten[poly]]
  21.     ]
  22.  
  23. End[ ]
  24.  
  25. Null
  26.