x = 3; (*ie 3 to generate table for proportion 4/15*)
p4 = Times @@ Prime[Range[x]];
p1 = Numerator[EulerPhi[p4]/p4];
p2 = Denominator[EulerPhi[p4]/p4];
p3 = EulerPhi[p4];
p5 = EulerPhi[p4]/p4;
p6 = p4/EulerPhi[p4];
k = Range[1, p3];
n = Function[P, Select[Range@P, CoprimeQ[#, P] &]]@
Product[Prime@i, {i, x}];
a1 = p5/k;
a2 = p6*k;
a3 = p6/k;
a4 = p5*k;
a5 = Numerator[a1];
a6 = Denominator[a1];
a7 = Numerator[a3];
a8 = Denominator[a3];
b = p2*k;
(*b\[Equal]a2*p1*)
c = p1*k;
d = p1*n;
e = b - d;
g = a2 - n;
(*e\[Equal]p1*g*)
f1 = e/a1;
f2 = e/a2;
f3 = e/a3;
f4 = e/a4;
h = Numerator[g];
i = Denominator[g];
l = Mod[b, n];
m = e - l;
o = Quotient[b, n];
treeOfCompositesTable =
List[p1, p2, p3, p4, p5, p6, k, n, a1, a2, a3, a4, a5, a6,
a7, a8,
b, c, d, e, f1, f2, f3, f4, g, h, i, l, m, o];
MatrixForm[treeOfCompositesTable];
Print["tree of composities"]
MatrixForm[Drop[treeOfCompositesTable, 6]]
Print["tree of composities transposed"]
MatrixForm[Transpose[Drop[treeOfCompositesTable, 6]]]
treeOfCompositesTableCalculationsTotal = {};
treeOfCompositesTableCalculationsMean = {};
treeOfCompositesTableCalculationsMin = {};
treeOfCompositesTableCalculationsMax = {};
treeOfCompositesTableCalculationsFirst = {};
treeOfCompositesTableCalculationsSecond = {};
treeOfCompositesTableCalculationsPenultimate = {};
treeOfCompositesTableCalculationsLast = {};
treeOfCompositesTableCalculationsDistinctCount = {};
treeOfCompositesTableCalculationsFirstDifferencesDistinctCount = {};
For[i = 7, i <= Length[treeOfCompositesTable], i++,
AppendTo[treeOfCompositesTableCalculationsTotal,
Total[treeOfCompositesTable[[i]]]];
AppendTo[treeOfCompositesTableCalculationsMean,
Mean[treeOfCompositesTable[[i]]]];
AppendTo[treeOfCompositesTableCalculationsMin,
Min[treeOfCompositesTable[[i]]]];
AppendTo[treeOfCompositesTableCalculationsMax,
Max[treeOfCompositesTable[[i]]]];
AppendTo[treeOfCompositesTableCalculationsFirst,
First[treeOfCompositesTable[[i]]]];
AppendTo[treeOfCompositesTableCalculationsSecond,
treeOfCompositesTable[[i]][[2]]];
AppendTo[treeOfCompositesTableCalculationsPenultimate,
treeOfCompositesTable[[i]][[-2]]];
AppendTo[treeOfCompositesTableCalculationsLast,
Last[treeOfCompositesTable[[i]]]];
AppendTo[treeOfCompositesTableCalculationsDistinctCount,
CountDistinct[treeOfCompositesTable[[i]]]];
AppendTo[
treeOfCompositesTableCalculationsFirstDifferencesDistinctCount,
CountDistinct[Differences[treeOfCompositesTable[[i]]]]]
]
treeOfCompositesTableCalculations =
List[treeOfCompositesTableCalculationsTotal,
treeOfCompositesTableCalculationsMean,
treeOfCompositesTableCalculationsMin,
treeOfCompositesTableCalculationsMax,
treeOfCompositesTableCalculationsFirst,
treeOfCompositesTableCalculationsSecond,
treeOfCompositesTableCalculationsPenultimate,
treeOfCompositesTableCalculationsLast,
treeOfCompositesTableCalculationsDistinctCount,
treeOfCompositesTableCalculationsFirstDifferencesDistinctCount];
Print["calculations"]
MatrixForm[treeOfCompositesTableCalculations]
Print["calculations transposed"]
MatrixForm[Transpose[treeOfCompositesTableCalculations]]