symboliclegendre[n_,x_]:=Solve[LegendreP[n,x]==0];
legendreprime[n_,a_]:=D[LegendreP[n,x],x]/.x->a;
weights[n_,x_]:=2/((1-x^2) legendreprime[n,x]^2);

(*how many terms should be generated*)
h=64;

(*what numerical precision is desired?*)
precision=16;

SetDirectory[NotebookDirectory[]]
str=OpenWrite["lgvalues.txt"];
Do[
WriteString[str,
"\nn = ",
n,
"\n"
];
WriteString[str,
"i = \t\t\t weight, w_{i} \t\t\t abscissa x_{i}\n"
];
Print[
"\nn = ",
n
];
Print[
"i  \t\t\t weight, w_{i} \t\t\t abscissa x_{i}"
];
nlist=symboliclegendre[n,x];
xnlist=x/.nlist;
Do[
WriteString[str,
i,
": \t\t\t ",
ScientificForm[Re[N[weights[n,Part[xnlist,i]],{Infinity,precision}]],NumberFormat->(#1<>"*10^("<>#3<>")"&)]//ToString,
" \t\t\t ",
ScientificForm[Re[N[Part[xnlist,i],{Infinity,precision}]], NumberFormat->(#1<>"*10^("<>#3<>")"&)]//ToString,
"\n"
];
Print[
i,
": \t\t\t ",
Re[N[weights[n,Part[xnlist,i]],{Infinity,precision}]],
" \t\t\t ",
Re[N[Part[xnlist,i],{Infinity,precision}]]
]
,{i,Length[xnlist]}];
,{n,2,h}];
Write[str];
Close[str];