(*********************************************************************

	Copyright 1989 by Roman E. Maeder
	
	Adapted from
	Roman E. Maeder: Programming in Mathematica, Addison-Wesley, 1989.

	Permission is hereby granted to make copies of this file for
	any purpose other than direct profit, or as part of a
	commercial product, provided this copyright notice is left
	intact.  Sale, other than for the cost of media, is prohibited.
	
	Permission is hereby granted to reproduce part or all of
	this file, provided that the source is acknowledged.

 *********************************************************************)


SwinnertonDyerP::usage =
	"SwinnertonDyerP[n, var] gives the minimal polynomial
	of the sum of the squareroots of the first n primes."

Begin["`Private`"]

SwinnertonDyerP[n_Integer?Positive, x_] :=
	Block[{arglist, poly, i},
		arglist = Outer[Times, Table[Sqrt[Prime[i]], {i, n}], {-1, 1}];
		poly = Outer[Plus, {x}, Sequence @@ arglist];
		Expand[Times @@ Flatten[poly]]
	]

End[]
Null
