Cultivating New Solutions for the Orchard-Planting Problem

MonthName 2, Year

Ed Pegg Jr
Wolfram Demonstrations Project Editor, Scientific Information Group

Some trees are planted in an orchard. What is the maximum possible number of distinct lines of three trees? In his 1821 book Rational Amusement for Winter Evenings, J. Jackson put it this way:

Fain would I plant a grove in rows
But how must I its form compose
	With three trees in each row;
To have as many rows as trees;
Now tell me, artists, if you please:
	’Tis all I want to know.

Those familiar with tic - tac - toe, three - in - a - row might wonder how difficult this problem could be, but it' s actually been looked at by some of the most prominent mathematicians of the past and present.This essay presents many new solutions that haven' t been seen before, shows a general method for finding more solutions and points out where current best solutions are improvable.

Various classic problems in recreational mathematics are of this type:
1. Plant 7 trees to make 6 lines of 3 trees. 
2. Plant 8 trees to make 7 lines of 3 trees. 
3. Plant 9 trees to make 10 lines of 3 trees. 
4. Plant 10 trees to make 12 lines of 3 trees. 
5. Plant 11 trees to make 16 lines of 3 trees.

Here is a graphic for the last problem, 11 trees with 16 lines of 3 trees. Subsets[points,{3}] collects all sets of 3 points. Abs[Det[Append[#,1]&/@#]] calculates the triangle area of each set. The sets with area 0 are the lines.

Module[{points, lines},
points={{-1,-1},{-1,1},{-1,-2+(Sqrt[5])},{0,-1},{0,0},{0,(1/2) (-1+(Sqrt[5]))},{1,-1},{1,1},{1,-2+(Sqrt[5])},{-(1/(Sqrt[5])),-1+(2/(Sqrt[5]))},{(1/(Sqrt[5])),-1+(2/(Sqrt[5]))}};
lines=Select[Subsets[points,{3}],Abs[Det[Append[#,1]&/@#]]==0&];Graphics[{EdgeForm[{Black, Thick}],Line[#]&/@lines,White,Disk[#,.1]&/@points}, ImageSize-> 540]]

This solution for 12 points matches the known limit of 19 lines, but uses simple integer coordinates and seems to be new. Lines are found with GatherBy and RowReduce, which quickly find a canonical line form for any 2 points in either 2D or 3D space.

Module[{name,root,vals,points, lines, lines3, lines2g},
name= "12 Points in 19 Lines of Three";
points={{0,0},{6,-6},{-6,6},{-2,-6},{2,6},{6,6},{-6,-6},{-6,0},{6,0},{0,3},{0,-3}};
lines = Union[Flatten[#,1]]&/@GatherBy[Subsets[points,{2}],RowReduce[Append[#,1]&/@#]&];
lines3 = Select[lines, Length[#]==3&];
lines2g=Select[lines, Length[#]==2 &&
(#[[2,2]]-#[[1,2]])/(#[[2,1]]-#[[1,1]])==-(3/2)&];
Text@Column[{name,Row[{"Point ", Style["●", Green,18], " at infinity"}],
 Graphics[{Thick,EdgeForm[Thick],Line[Sort[#]]&/@lines3,Green,InfiniteLine[#]&/@lines2g,{ White,Disk[#,.5] }&/@points}, ImageSize-> 400,PlotRange-> {{-7,7},{-7,7}} ]}, Alignment-> Center]]

This blog goes far beyond those old problems. Here’s how 27 points can make 109 lines of 3 points. If you’d like to see the best-known solutions for 7 to 27 points, skip to the gallery of solutions at the end. For the math, code and methodology behind these solutions, keep reading.

With[{n=27},Quiet@zerosumGraphic[If[orchardsolutions[[n,2]]>orchardsolutions[[n,3]],orchardsolutions[[n,6]],Quiet@zerotripsymm[orchardsolutions[[n,4]],Floor[(n-1)/2]]], n, {260,210}2]]

What is the behavior as the number of trees increases? MathWorld’s orchard-planting problem, Wikipedia’s orchard-planting problem and the On-Line Encyclopedia of Integer Sequences sequence A003035 list some of what is known. Let m be the number of lines containing exactly three points for a set of p points. In 1974, Burr, Grünbaum and Sloane (BGS) gave solutions for particular cases and proved the bounds (Floor[(1/6) (p-3) p])+1≤m≤min((Floor[(1/3) ((1/2) (p-1) p-(Ceiling[((3 p)/7)]))]),(Floor[(1/3) p (Floor[((p-1)/2)])])) . Here’s a table.

droppoints=3;
Style[Text@Grid[Transpose[
Drop[Prepend[Transpose[{Range[7,28],Drop[#[[2]]&/@orchardsolutions,6],{6,7,10,12,16,19,22,26,32,37,42,48,54,60,67,73,81,88,96, 104, 113, 121},
(Floor[# (#-3)/6]+1)&/@Range[7,28],
Min[{Floor[#/3 Floor[(#-1)/2]],Floor[(Binomial[#,2]-Ceiling[3 #/7])/3]}]&/@Range[7,28], 
{2,2,3,5,6,7,9,10,12,15,16,18,20,23,24,26,28,30,32,"?","?","?"},
{2,2,3,5,6,7,9,10,12,15,16,18,28,30,31,38,40,42,50,"?","?","?"}
}],{"points", "maximum known lines of three", "proven upper bound","BGS lower bound", "BGS upper bound", "4-orchard lower bound", "4-orchard upper bound"}],-droppoints]],Dividers->{{2->Red},{2->Red, 4-> Blue, 6-> Blue}}],12]

Terence Tao and Ben Green recently proved that the maximum number of lines is the BGS lower bound most of the time (“On Sets Defining Few Ordinary Lines”), but they did not describe how to get the sporadic exceptions. Existing literature does not currently show the more complicated solutions. For this blog, I share a method for getting elegant-looking solutions for the three-orchard problem, as well as describing and demonstrating the power of a method for finding the sporadic solutions. Most of the embeddings shown in this blog are new, but they all match existing known records.

For a given number of points p, let q=(Floor[(p-1)/2]); select the 3-subsets of {-q,-q+1,…,q} that have a sum of 0 (mod p). That gives (Floor[ (p-3) p/6])+1 3-subsets. Here are the triples from p=8 to p=14. This number of triples is the same as the lower bound for the orchard problem, which Tao and Green proved was the best solution most of the time.

Text@Grid[Prepend[Table[With[{triples=
Select[Subsets[Range[-Floor[(p-1)/2],Ceiling[(p-1)/2]],{3}],Mod[Total[#],p]==0&]},{p, Length[triples],
Row[Row[
Text@Style[ToString[Abs[#]],{Red,Darker[Green],Blue}[[If[#==p/2,2,Sign[#]+2]]],25-p] &/@#]&/@triples,Spacer[1]]}],{p,8,14}],{" p ", " lines ", Row[
{" triples with zero sum (mod p) with red negative, green zero and blue positive"}]}], Spacings-> {0,0},Frame->All]

Here’s a clearer graphic for how this works. Pick three different numbers from -8 to 8 that have a sum of zero. You will find that those numbers are on a straight line. The method used to place these numbers will come later.

That’s not the maximum possible number of lines. By moving these points some, the triples that have a modulus-17 sum of zero can also be lines. One example is 4 + 6 + 7 = 17.

With[{n=17},Quiet@zerosumGraphic[If[orchardsolutions[[n,2]]>orchardsolutions[[n,3]],orchardsolutions[[n,6]],Quiet@zerotripsymm[orchardsolutions[[n,4]],Floor[(n-1)/2]]], n, {260,210}2]]

Does this method always give the best solution? No—there are at least four sporadic exceptions. Whether any other sporadic solutions exist is not known.

Grid[Partition[zerosumGraphic[orchardsolutions[[#,6]], #,{260,210}]&/@{7,11,16,19},2]]

More Than Three in a Row

There are also problems with more than three in a row.

1. Plant 16 trees to make 15 lines of 4 trees.
2. Plant 18 trees to make 18 lines of 4 trees.
3. Plant 25 trees in 18 lines of 5 points.
4. Plant 112 trees in 3D to make 27 lines of 7 trees.

Fifteen lines of four points using 15 points is simple enough. RowReduce is used to collect lines, with RootReduce added to make sure everything is in a canonical form.

Module[{pts, lines},
pts=Append[Join[RootReduce[Table[{Sin[2 Pi n/5],Cos[2 Pi n/5]},{n,0,4}]],
RootReduce[(1/2) (3-(Sqrt[5]))Table[{Sin[2 Pi n/5],-Cos[2 Pi n/5]},{n,0,4}]],RootReduce[((1/2) (3-(Sqrt[5])))^2Table[{Sin[2 Pi n/5],Cos[2 Pi n/5]},{n,0,4}]]],{0,0}];
lines=Union[Flatten[#,1]]&/@Select[SplitBy[SortBy[Subsets[pts,{2}],RootReduce[RowReduce[Append[#,1]&/@#]]&],RootReduce[RowReduce[Append[#,1]&/@#]]&],Length[#]>3&];
Graphics[{Thick,Line/@lines,EdgeForm[{Black, Thick}],White,Disk[#,.05]&/@pts}, ImageSize-> 520]]

Eighteen points in 18 lines of 4 points is harder, since it seems to require 3 points at infinity. When lines are parallel, projective geometers say that the lines intersect at infinity. With 4 points on each line and each line through 4 points, this is a 4-configuration.

Module[{config18,linesconfig18,inf},config18={{0,Root[9-141 ((#1)^2)+((#1)^4)&,1]},{(1/4) (-21-9 (Sqrt[5])),Root[9-564 ((#1)^2)+16 ((#1)^4)&,4]},{(1/4) (21+9 (Sqrt[5])),Root[9-564 ((#1)^2)+16 ((#1)^4)&,4]},{0,-2 (Sqrt[3])},{-3,(Sqrt[3])},{3,(Sqrt[3])},{0,(Sqrt[3])},{(3/2),-((Sqrt[3])/2)},{-(3/2),-((Sqrt[3])/2)},{(1/4) (3+3 (Sqrt[5])),Root[9-564 ((#1)^2)+16 ((#1)^4)&,4]},{(1/4) (9+3 (Sqrt[5])),Root[225-420 ((#1)^2)+16 ((#1)^4)&,1]},{(1/2) (-6-3 (Sqrt[5])),-((Sqrt[3])/2)},{0,Root[144-564 ((#1)^2)+((#1)^4)&,4]},{(1/2) (21+9 (Sqrt[5])),Root[9-141 ((#1)^2)+((#1)^4)&,1]},{(1/2) (-21-9 (Sqrt[5])),Root[9-141 ((#1)^2)+((#1)^4)&,1]}};
linesconfig18=SplitBy[SortBy[Union[Flatten[First[#],1]]&/@
(Transpose/@Select[
SplitBy[SortBy[{#, RootReduce[RowReduce[Append[#,1]&/@#]]}&/@Subsets[config18,{2}],Last],Last],Length[#]>1&]),Length],Length];
inf =Select[ SplitBy[SortBy[linesconfig18[[1]],RootReduce[slope[Take[#,2]]]&],RootReduce[slope[Take[#,2]]]&],Length[#]>3&];
Graphics[{Thick, Line/@linesconfig18[[2]], Red, InfiniteLine[Take[#,2]]&/@inf[[1]], Green, InfiniteLine[Take[#,2]]&/@inf[[2]], Blue, InfiniteLine[Take[#,2]]&/@inf[[3]], EdgeForm[Black],White,Disk[#,.7]&/@config18}, ImageSize-> {520,460}]]

If you do not like points at infinity, arrange 3 heptagons of 7 points to make a 4-configuration of 21 lines through 21 points. That isn’t the record, since it is possible to make at least 24 lines of 4 with 21 points.

Module[{pts,lines},pts=4{{0,-b},{0,((b c)/(a-c))},{2 a,-b}, {0,-((b c)/(2 a+c))},{0,((b c)/(3 a-c))},{-a,-b},{a,-b},{-c,0},{-(c/3),0},{(c/3),0},{c,0},{-((3 a c)/(3 a-2 c)),((2 b c)/(3 a-2 c))},{((a c)/(3 a-2 c)),((2 b c)/(3 a-2 c))},{((3 a c)/(3 a-2 c)),((2 b c)/(3 a-2 c))},{((a c)/(5 a-2 c)),((2 b c)/(5 a-2 c))},{((a c)/(-5 a+2 c)),((2 b c)/(5 a-2 c))},{((a c)/(-3 a+2 c)),((2 b c)/(3 a-2 c))},{-((a c)/(a+2 c)),-((2 b c)/(a+2 c))},{((a c)/(a+2 c)),-((2 b c)/(a+2 c))},{-((a c)/(3 a+2 c)),-((2 b c)/(3 a+2 c))},{((a c)/(3 a+2 c)),-((2 b c)/(3 a+2 c))}}/.{a-> 2,c->1, b-> 1};
lines=Union[Flatten[#,1]]&/@Select[SplitBy[SortBy[Subsets[pts,{2}],RowReduce[Append[#,1]&/@#]&],RowReduce[Append[#,1]&/@#]&],Length[#]>3&];
Graphics[{Line/@lines,EdgeForm[Black],White,Disk[#,.3]&/@pts}, ImageSize-> 500]]

The best-known solution for 25 points has 32 lines, but this solution seems weak due to the low contribution made by the last 3 points. Progressively remove points labeled 25, 24, 23 (near the bottom) to see the best-known solutions that produce 30, 28, 26 lines.

Module[{pts, lines},
pts = {{0,(1/4)},{0,(3/4)},{-1,(1/2)},{1,(1/2)},{-1,1},{1,1},{0,0},{0,(3/8)},{-(1/3),(1/3)},{(1/3),(1/3)},{-(1/3),(1/6)},{(1/3),(1/6)},{-(1/5),(2/5)},{(1/5),(2/5)},{-(1/5),(1/2)},{(1/5),(1/2)},{-1,-(1/2)},{1,-(1/2)},{-1,-1},{1,-1},{-(1/3),(2/3)},{(1/3),(2/3)},{-(1/3),-(2/3)},{(1/3),-(2/3)},{(9/5),-(6/5)}};
lines=SplitBy[SortBy[
(Union[Flatten[#,1]]&/@SplitBy[SortBy[Subsets[pts,{2}],
RowReduce[Append[#,1]&/@#]&],
RowReduce[Append[#,1]&/@#]&]),Length],Length];
Graphics[{InfiniteLine[Take[#,2]]&/@lines[[3]],
White,EdgeForm[Black],Table[{Disk[pts[[n]],.04], Black,Style[Text[n,pts[[n]]],8]},{n,1,Length[pts]}]&/@pts,Black}, ImageSize-> {520}]]

The 27 lines in space are, of course, the Clebsch surface. There are 12 points of intersection not shown, and some lines have 9 points of intersection.

Module[{lines27, clebschpoints},
lines27=Transpose/@Flatten[Join[Table[RotateRight[#,n],{n,0,2}]&/@
{{{-(1/3),-(1/3)},{1,-1},{-1,1}}, {{0,0},{1,-(2/3)},{-(2/3),1}}, {{(1/3),(1/3)},{1,-(1/3)},{-(1/3),1}},{{0,0},{(4/9),-(2/9)},{1,-1}},{{0,0},{1,-1},{(4/9),-(2/9)}}},Permutations[#]&/@{{{30,-30},{35-19 (Sqrt[5]),-25+17 (Sqrt[5])},{5+3 (Sqrt[5]),5-9 (Sqrt[5])}}/30,{{6,-6},{-3+2 (Sqrt[5]),6-(Sqrt[5])},{-7+4 (Sqrt[5]),8-5 (Sqrt[5])}}/6}],1];
clebschpoints=Union[RootReduce[Flatten[With[
{sol=Solve[e #[[1,1]]+(1-e)#[[1,2]] == f #[[2,1]]+(1-f)#[[2,2]]]},If[Length[sol]>0,(e #[[1,1]]+(1-e)#[[1,2]])/.sol, Sequence@@{} ]]&/@Subsets[lines27,{2}],1]]];
Graphics3D[{{ Sphere[#,.04]&/@Select[clebschpoints,Norm[#]<1&]},Tube[#,.02]&/@lines27,Opacity[.4],ContourPlot3D[81 (x^3+y^3+z^3)-189 (x^2 y+x^2 z+x y^2+x z^2+y^2 z+y z^2)+54 x y z+126 (x y+x z+y z)-9 (x^2+y^2+z^2)-9 (x+y+z)+1==0,{x,-1,1},{y,-1,1},{z,-1,1}, Boxed-> False][[1]]}, Boxed-> False, SphericalRegion-> True,ImageSize-> 520, ViewAngle->Pi/8]]

I’m not sure that’s optimal, since I managed to arrange 149 points in 241 lines of 5 points.

Module[{majorLines, tetrahedral,base,points,lines},
majorLines[pts_]:=((Drop[#1,-1]&)/@#1&)/@Select[(Union[Flatten[#1,1]]&)/@SplitBy[SortBy[Subsets[(Append[#1,1]&)/@pts,{2}],RowReduce],RowReduce],Length[#1]>4&];
tetrahedral[{a_,b_,c_}]:=Union[{{a,b,c},{a,-b,-c},{b,c,a},{b,-c,-a},{c,a,b},{c,-a,-b},{-c,a,-b},{-c,-a,b},{-b,c,-a},{-b,-c,a},{-a,b,-c},{-a,-b,c}}];
base={{0,0,0},{180,180,180},{252,252,-252},{420,420,420},{1260,1260,-1260},{0,0,420},{0,0,1260},{0,180,360},{0,315,315},{0,360,180},{0,420,840},{0,630,630},{0,840,420},{140,140,420},{180,180,-540},{252,252,756},{420,420,-1260}};
points=Union[Flatten[tetrahedral[#]&/@base,1]];
lines =majorLines[points];
Graphics3D[{Sphere[#,50]&/@points, Tube[Sort[#],10]&/@Select[lines,Length[#]==5&]}, Boxed-> False, ImageSize-> {500,460}]]

The 3D display is based on the following 2D solution, which has 25 points in 18 lines of 5 points. The numbers are barycentric coordinates. To use point 231, separate the digits (2,3,1), divide by the total (2/6,3/6,1/6) and simplify (1/3,1/2,1/6). If the outer triangle has area 1, the point 231 extended to the outer edges will make triangles of area (1/3,1/2,1/6).

Module[{peggpoints,elkpoints,elklines,linecoords},
peggpoints=Sort[#/Total[#]&/@
Flatten[(Permutations/@{{0,0,1},{0,1,1},{0,1,2},{0,4,5},{1,1,2},{1,2,2},
{1,2,3},{1,2,6},{1,4,4},{2,2,3},{2,2,5},{2,3,4},{2,3,5},{2,5,5},{2,6,7},{4,5,6}}),1]];elkpoints =Sort[#/Total[#]&/@
Flatten[(Permutations/@{{1,1,1},{0,0,1},{1,2,3},{1,1,2},{0,1,1},{1,2,2}, {0,1,2}}),1]];elklines =First/@Select[SortBy[Tally[BaryLiner[#]&/@Subsets[elkpoints,{2}]],Last],Last[#]>4&];
linecoords =Table[FromBarycentrics[{#[[1]], #[[2]]}, tri]&/@Select[elkpoints, elklines[[n]].#==0&],{n,1,18}];Graphics[{AbsoluteThickness[3],Line/@linecoords,
With[{coord = FromBarycentrics[{#[[1]], #[[2]]}, tri]},{Black,Disk[coord,.12],White,Disk[coord,.105],Black,Style[Text[StringJoin[ToString/@(# (Max[Denominator[#]]))], coord],14, Bold]}]&/@elkpoints}, ImageSize-> {520,450}]]

A further exploration of this is at Extreme Orchards for Gardner. There, I ask if a self-dual configuration exists where the point set is identical to the line set. I managed to find the following 24-point 3-configuration. The numbers 021 represent {0,2,–1}, with blue = positive, red = negative and green = zero. In barycentric coordinates, a line {a,b,c} is on point {d,e,f} if the dot product {a,b,c}.{d,e,f}==0. For point {0,2,–1}, the lines {{–1,1,2},{–1,2,4},{0,1,2}} go through that point. Similarly, for line {0,2,–1}, the points {{–1,1,2},{–1,2,4},{0,1,2}} are on that line. The set of 24 points is identical to the set of 24 lines.

FromBarycentrics[{m_,n_,o_},{{x1_,y1_},{x2_,y2_},{x3_,y3_}}]:={m*x1+n*x2+(1-m-n)*x3,m*y1+n*y2+(1-m-n)*y3};
tri=Reverse[{{((Sqrt[3])/2),-(1/2)},{0,1},{-((Sqrt[3])/2),-(1/2)}}];With[{full=Union[Flatten[{#, RotateRight[#,1],RotateLeft[#,1]}&/@
{{-1,0,2},{-1,1,2},{-1,2,0},{-1,2,1},{-1,2,4},{-1,4,2},{0,1,2},{0,2,1}},1]]},
Graphics[{EdgeForm[Black],Tooltip[Line[#[[2]]],Style[Row[
Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#[[1]]],16,Bold]]&/@Table[{full[[k]],Sort[FromBarycentrics[#/Total[#],tri]&/@
Select[full,full[[k]].#==0&]]},{k,1,Length[full]}],White,{Disk[FromBarycentrics[#/Total[#],tri],.15],Black, Style[Text[Row[Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,
Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#],FromBarycentrics[#/Total[#],tri]],14,Bold]}&/@full}, ImageSize-> 520]]

With a longer computer run, I found an order-27, self-dual 4-configuration where the points and lines have the same set of barycentric coordinates.

With[{full=Union[Flatten[{#, RotateRight[#,1],RotateLeft[#,1]}&/@{{-2,-1,4},{-2,1,3},{-1,1,1},{-1,2,0},{-1,2,1},{-1,3,2},{-1,4,2},{0,1,2},{1,1,2}},1]]},
Graphics[{EdgeForm[Black],Tooltip[Line[#[[2]]],Style[Row[
Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#[[1]]],16,Bold]]&/@Table[{full[[k]],Sort[FromBarycentrics[#/Total[#],tri]&/@Select[full,full[[k]].#==0&]]},{k,1,Length[full]}],White,{Tooltip[Disk[FromBarycentrics[#/Total[#],tri],.08], Style[Row[Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#],16,Bold]]}&/@full}, ImageSize-> 520]]

And now back to the mathematics of three-in-a-row, frequently known as elliptic curve theory, but I’ll mostly be veering into geometry.

Cubic Curves and Zero-Sum Geometries

In the cubic curve given by y=(x^3), all the triples from {-7,-6,…,7} that sum to zero happen to be on a straight line. The Table values are adjusted so that the aspect ratio will be reasonable.

simplecubic =Table[{x/7,x^3 /343},{x,-7,7}];
Graphics[{Cyan,Line[Sort[#]]&/@Select[Subsets[simplecubic,{3}],
Abs[Det[Append[#,1]&/@#]]==0&],{Black,Disk[#,.07], White,Disk[#,.06],Black, Style[Text[7#[[1]],#],16] }&/@simplecubic}, ImageSize-> 520]

For example, (2,3,-5) has a zero-sum. For the cubic curve, those numbers are at coordinates (2,8), (3,27) and (-5,-125), which are on a line. The triple (-(2^(1/3)),-(3^(1/3)),(2^(1/3))+(3^(1/3))) also sums to zero and the corresponding points also lie on a straight line, but ignore that: restrict the coordinates to integers. With the curve y=(x^3), all of the integers can be plotted. Any triple of integers that sums to zero is on a straight line.

TraditionalForm[Row[{Det[MatrixForm[{{2,8,1},{3,27,1},{-5,-125,1}}]], " = ", 
Det[{{2,8,1},{3,27,1},{-5,-125,1}}]}]]

We can use the concept behind the cubic curve to make a rotationally symmetric zero-sum geometry around 0. Let blue, red and green represent positive, negative and zero values. Start with:

({{value, coordinates}, {0, (0,0)}, {1, (a,b)}, {-1, (-a,-b)}, {2, (c,d)}, {-2, (-c,-d)}})

To place the values 3 and 4, variables e and f are needed. The positions of all subsequent points up to infinity are forced.

({{ , rotationally symmetric,  }, {value, location, triples}, {0, (0,0),  -}, {1, (a,b),  -}, {-1, (-a,-b), 101}, {2, (c,d),  -}, {-2, (-c,-d), 202}, {3, on line(OverBar[12])ate 1+(1-e) 2, -}, {-3, on line(OverBar[13])ate 1+(1-e)3, 303,312,213}, {4, on line(OverBar[13])atf 1+(1-f) 3, -}, {-4, on line(OverBar[13])atf 1+(1-f)3, 404,413,314}})

Note that e and f should not be 0 or 1, since that would cause all subsequent points to overlap on the first five points.

Instead of building around 0, values can instead be reflected in the y=x diagonal to make a mirror-symmetric zero-sum geometry.

({{ , mirror symmetric,  }, {value, location, triples}, {0, ∞,  -}, {1, (a,b),  -}, {-1, (b,a), 101}, {2, (c,d),  -}, {-2, (d,c), 202}, {3, on line(OverBar[12])ate 1+(1-e) 2, -}, {-3, on line(OverBar[13])ate 1+(1-e)3, 303,312,213}, {4, on line(OverBar[13])atf 1+(1-f) 3, -}, {-4, on line(OverBar[13])atf 1+(1-f)3, 404,413,314}})

Skew symmetry is also possible with the addition of variables (m,n).

({{ , skew symmetric,  }, {value, location, triples}, {0, (0,0),  -}, {1, (a,b),  -}, {-1, m (a,b), 101}, {2, (c,d),  -}, {-2, n (c,d), 202}, {3, on line(OverBar[12])ate 1+(1-e) 2, -}, {-3, on line(OverBar[13])ate 1+(1-e)3, 303,312,213}, {4, on line(OverBar[13])atf 1+(1-f) 3, -}, {-4, on line(OverBar[13])atf 1+(1-f)3, 404,413,314}})

The six variables (a,b,c,d,e,f) completely determine as many points as you like with rotational symmetry about (0,0) or mirror symmetry about the line y=x. Adding the variables (m,n) allows for a skew symmetry where the lines (OverBar[11]) and (OverBar[22]) intersect at (0,0). In the Manipulate, move  to change (a,b) and  to change (c,d). Move  horizontally to change e and vertically to change f. For skew symmetry, move  to change the placements of 1 and 2.

Manipulate[
Module[{ halfpoints,triples,initialpoints,pts2,candidate2},
halfpoints=Ceiling[(numberofpoints-1)/2];
triples=Select[Subsets[Range[-halfpoints,halfpoints],{3}],Total[#]==0&];
initialpoints= rotational/.Thread[{a,b,c,d,e,f}-> Flatten[{ab,cd,ef}]];
If[symmetry=="mirror",initialpoints= mirror/.Thread[{a,b,c,d,e,f}-> Flatten[{ab,cd,ef}]]];
If[symmetry=="skew",
initialpoints= skew/.Thread[{a,b,c,d,e,f,m,n}-> Flatten[{ab,cd,ef,mn}]]];
pts2=Join[initialpoints,Table[{{0,0},{0,0}},{46}]];
Do[pts2[[index]]=(LineIntersectionPoint33[{{pts2[[1,#]],pts2[[index-1,#]]},{pts2[[2,#]],pts2[[index-2,#]]}}]&/@{2,1}),
{index,5,50}];
If[showcurve,candidate2=NinePointCubic2[First/@Take[pts2,9]],Sequence@@{}];
Graphics[{
EdgeForm[Black],
If[showcurve,ContourPlot[Evaluate[{candidate2==0}],{x,-3,3},{y,-3,3}, PlotPoints->15][[1]], Sequence@@{}],
If[showlines,If[symmetry=="mirror",
{Black,Line[pts2[[Abs[#],(3-Sign[#])/2 ]]&/@#]&/@Select[triples,Not[MemberQ[#,0]]&],
Green,InfiniteLine[pts2[[Abs[#],(3-Sign[#])/2 ]]&/@#]&/@(Drop[#,{2}]&/@Select[triples,MemberQ[#,0]&])},
{Black,Line[If[#==0,{0,0},pts2[[Abs[#],(3-Sign[#])/2 ]]]&/@#]&/@triples}], Sequence@@{}],
If[extrapoints>0,Table[{White,Disk[pts2[[n,index]],.03]},{n,halfpoints+1, halfpoints+extrapoints},{index,1,2}], Sequence@@{}],
Table[{White,Disk[pts2[[n,index]],.08],{Blue,Red}[[index]],Style[Text[n,pts2[[n,index]]] ,12]},{n,halfpoints,1,-1},{index,1,2}],
If[symmetry≠ "mirror",{White,Disk[{0,0},.08],Green, Style[Text[0,{0,0}] ,12]},Sequence@@{}],
Inset[,ab],Inset[,cd],Inset[,ef],If[symmetry=="skew",Inset[,mn], Sequence@@{}]},
 ImageSize-> {380,480}, PlotRange->Dynamic[(3/2)^zoom{{-2.8,2.8}-zx/5,{-2.5,2.5}-zy/5}]]],
{{ab,{2,2}},{-2.4,-2.4},{2.4,2.4},ControlType->Locator, Appearance-> None},
{{cd,{2,-2}},{-2.4,-2.4},{2.4,2.4},ControlType->Locator, Appearance-> None},
{{ef,{.7,.13}},{-2.4,-2.4},{2.4,2.4},ControlType->Locator, Appearance-> None},
{{mn,{-2.00,-0.5}},{-2.4,-2.4},{2.4,2.4},ControlType->Locator, Appearance-> None},
"symmetry",
Row[{Control@{{symmetry,"rotational",""},{"rotational","mirror","skew"}, ControlType-> PopupMenu}}],
"",
"points shown",
{{numberofpoints,15,""},5, 30,2,ControlType-> PopupMenu},
"",
"extra points",
{{extrapoints,0,""},0, 20,1,ControlType-> PopupMenu},
"",
"move zero",
Row[{Control@{{zx,0,""},-10,10,1,ControlType-> PopupMenu}," 5", Style["x", Italic]}],
Row[{Control@{{zy,0,""},-10,10,1,ControlType-> PopupMenu}," 5", Style["y", Italic]}],
"",
"zoom exponent",
{{zoom,0,""},-2,3,1,ControlType-> PopupMenu},
"",
"show these",
Row[{Control@{{showlines,True,""},{True,False}},"lines"}],
Row[{Control@{{showcurve,False,""},{True,False}},"curve"}],
 TrackedSymbols:>{ab,cd,ef,mn,zx,zy, symmetry,numberofpoints, extrapoints, zoom},
ControlPlacement-> Left, 
Initialization:>  (
Clear[a]; Clear[b]; Clear[c]; Clear[d]; Clear[e]; Clear[f]; Clear[m]; Clear[n];
NinePointCubic2[pts3_]:= Module[{makeRow2, cubic2,poly2, coeff2, nonzero, candidate},
If[Min[Total[Abs[RowReduce[#][[3]]]]&/@Subsets[Append[#,1]&/@pts3,{4}]]>0,
makeRow2[{x_,y_}]:={1,x,x^2,x^3,y,y x, y x^2, y^2, y^2 x, y^3};
cubic2[x_,y_][p_]:=Det[makeRow2/@Join[{{x,y}},p]];
poly2=cubic2[x,y][pts3];
coeff2 = Flatten[CoefficientList[poly2,{y,x}]];
nonzero = First[Select[coeff2,Abs[#]>0&]];
candidate= Expand[Simplify[ poly2/nonzero]];
If[Length[FactorList[candidate]]>2,"degenerate",candidate],
"degenerate"]];
LineIntersectionPoint33[{{a_,b_},{c_,d_}}]:=((Det[{a,b}] (c-d)-Det[{c,d}] (a-b))/(Det[{a-b,c-d}]));
skew={{{a,b},{a m,b m}},{{c,d},{c n,d n}},{{a e m-c (-1+e) n,b e m-d (-1+e) n},{((a e m+c n-c e n)/(e m+n-e n)),((b e m+d n-d e n)/(e m+n-e n))}},{{a f m-(((-1+f) (a e m-c (-1+e) n))/(e (m-n)+n)),b f m-(((-1+f) (b e m-d (-1+e) n))/(e (m-n)+n))},{((c (-1+e) (-1+f) n+a m (e+e f (-1+m-n)+f n))/(1+f (-1+e m (m-n)+m n))),((d (-1+e) (-1+f) n+b m (e+e f (-1+m-n)+f n))/(1+f (-1+e m (m-n)+m n)))}}};
rotational={#,-#}&/@{{a,b},{c,d},{c (-1+e)-a e,d (-1+e)-b e},{c (-1+e) (-1+f)+a (e-(1+e) f),d (-1+e) (-1+f)+b (e-(1+e) f)}};
mirror={#,Reverse[#]}&/@{{a,b},{c,d},{d (1-e)+b e,c (1-e)+a e},{(c (1-e)+a e) (1-f)+b f,(d (1-e)+b e) (1-f)+a f}};),
SynchronousInitialization->False,SaveDefinitions->True]

In the rotationally symmetric construction, point 7 can is derived by finding the intersection of lines (OverBar[16]), (OverBar[25]) and (OverBar[34]).

TraditionalForm[FullSimplify[{h zerosumgeometrysymmetric[[2,2]] + (1-h) zerosumgeometrysymmetric[[5,2]] } /.Solve[h zerosumgeometrysymmetric[[2,2]] + (1-h) zerosumgeometrysymmetric[[5,2]] ==j zerosumgeometrysymmetric[[3,2]] + (1-j) zerosumgeometrysymmetric[[4,2]] ,{h,j}][[1]]][[1]]]

The simple cubic had 15 points 7 to 7 producing 25 lines. That falls short of the record 31 lines. Is there a way to get 6 more lines? Notice 6 triples with a sum of 0 modulus 15:

Select[Subsets[Range[-7,7],{3}], Abs[Total[#]]==15&]

We can build up the triangle area matrices for those sets of points. If the determinant is zero, the points are on a straight line.

matrices15=Append[zerosumgeometrysymmetric[[#,1]],1]&/@#&/@{{2,6,7},{3,5,7},{4,5,6}};
Row[TraditionalForm@Style[MatrixForm[#]]&/@(matrices15),Spacer[20]]

Factor each determinant and hope to find a shared factor other than b c-a d, which puts all points on the same line. It turns out the determinants have -e+(e^2)+f-e f+(f^2)-e (f^2)+(f^3) as a shared factor.

Column[FactorList[Numerator[Det[#]]]&/@matrices15]

Are there any nice solutions for -e+(e^2)+f-e f+(f^2)-e (f^2)+(f^3)=0? Turns out letting e=ϕ (the golden ratio) allows f=-1.

Take[SortBy[Union[
Table[FindInstance[-e+(e^2)+f-e f+(f^2)-e (f^2)+(f^3)==0&&e>0&&f>ff,{e,f},Reals],{ff,-2,2,1/15}]],LeafCount],6]

Here’s what happens with base points (a,b)=(1,1), (c,d)=(1,-1) and that value of (e,f).

points15try =RootReduce[zerotripsymm[{1,1,1,-1, (1+(Sqrt[5]))/2,-1},7]];
zerosumGraphic[points15try/5, 15,1.5{260,210}]

The solution’s convex hull is determined by points 4 and 2, so those points can be moved to make the solution more elegant.

RootReduce[({{w,x},{y,z}}/.Solve[{{{w,x},{y,z}}.points15try[[2,1]]=={1,1}, 
{{w,x},{y,z}}.points15try[[4,1]]=={-1,1}}][[1]]).#&/@{points15try[[1,1]],
points15try[[2,1]]}]

The values for (a,b,c,d) do not need to be exact, so we can find the nearest rational values.

nearestRational[#,20]&/@Flatten[{{9-4 (Sqrt[5]),5-2 (Sqrt[5])},{1,1}}]

That leads to an elegant-looking solution for the 15-tree problem. There are 31 lines of 3 points, each a triple that sums to 0 (mod 15).

points15 =RootReduce[zerotripsymm[{(1/18),(9/17),1,1, (1+(Sqrt[5]))/2,-1},7]];
zerosumGraphic[points15, 15,1.5{260,210}]

The 14-point version leads to polynomial equation 2 e-2 (e^2)-f+e f+(e^2) f-e (f^2)=0, which has the nice solution {e->1/2,f-> (-1+(Sqrt[17]))/4}. A point at infinity is needed for an even number of points with this method.

points14=RootReduce[zerotripsymm[{1,1,1,-1, 1/2,(-1+(Sqrt[17]))/4},6]]
zerosumGraphic[points14, 14,1.5{260,210}]

The solution on 15 points can be tweaked to give a match for the 16-point, 37-line solution in various ways. The 8 is not particularly meaningful here. The last example is done with skew symmetry, even though it seems the same.

Grid[Partition[{zerosumGraphic[zerotripsymm[{5-2 (Sqrt[5]),9-4 (Sqrt[5]),1,1,(1/2) (1+(Sqrt[5])),-1},7], 15,{260,210}],zerosumGraphic[zerotripsymm[{5-2 (Sqrt[5]),9-4 (Sqrt[5]),1,1,(1/2) (1+(Sqrt[5])),-1},7], 16,{260,210}],
zerosumGraphic[zerotripsymm[{1,1,1,-1,3-(Sqrt[5]),(1/2) (3-(Sqrt[5]))},7], 16,{260,210}],
zerosumGraphic[RootReduce[zerotripskew[{0,1-(Sqrt[5]),-3+(Sqrt[5]),-3+(Sqrt[5]),-1+(Sqrt[5]),(1/2) (1+(Sqrt[5])),(1/2) (-1+(Sqrt[5])),(1/2) (1+(Sqrt[5]))},7]], 16,{260,210}]},2]]

The first solution is a special case of the 15-solution with an abnormal amount of parallelism, enough to match the sporadic 16-point solution. How did I find it?

Orchard-Planting Polynomials

Here are coordinates for the positive points up to 4 in the mirror-symmetric and skew-symmetric cases. They quickly get more complicated.

TraditionalForm@Grid[Prepend[Transpose[Prepend[Transpose[First/@Take[zerosumgeometrymirror,4]],Range[1,4]]],{"number",x,y}],Dividers->{{2->Green},{2->Green}}]

TraditionalForm@Grid[Prepend[Transpose[Prepend[Transpose[Prepend[First/@Take[zerosumgeometryskew,4],{0,0}]],Range[0,4]]],{"number",x,y}],Dividers->{{2->Blue},{2->Blue}}]

Here are coordinates for the positive points up to 7 in the rotationally symmetric case. These are more tractable, so I focused on them.

TraditionalForm@Grid[Prepend[Transpose[Prepend[Transpose[Prepend[First/@Take[zerosumgeometrysymmetric,7],{0,0}]],Range[0,7]]],{"number",x,y}],Dividers->{{2->Red},{2->Red}}]

For 14 and 15 points, the polynomials 2 e-2 (e^2)-f+e f+(e^2) f-e (f^2) and -e+(e^2)+f-e f+(f^2)-e (f^2)+(f^3) appeared almost magically to solve the problem. Why did that happen? I have no idea, but it always seems to work. I’ll call these orchard-planting polynomials. It’s possible that they’ve never been used before to produce elegant solutions for this problem, because we would have seen them. Here are the next few orchard-planting polynomials. As a reminder, these are shared factors of the determinants generated by forcing triples modulo p to be lines.

Monitor[TraditionalForm@Grid[Prepend[Table[
With[{subs=Select[Subsets[Range[-Floor[n/2],Floor[n/2]],{3}],Mod[ Abs[Total[#]],n ]==0&&Not[MemberQ[#,-(n/2)]]&]}, {n, Length[subs], Select[subs,Min[#]>0&&Max[#]<13&&Max[#]<n/2&], Last[SortBy[Apply[Intersection,(First[Sort[FullSimplify[{#,-#}]]]&/@First/@FactorList[Numerator[#]]&/@Expand[Det[Append[zerosumgeometrysymmetric[[#,1]],1]&/@#]&/@Select[subs,Min[#]>0&&Max[#]<13&&Max[#]<n/2&]])],LeafCount]]}],{n,11,16}],{"trees", "lines", "triples needing modulus", "orchard planting polynomial"}]],n]

Here is the major step for the solution of 14 trees. The item showing up in the numerator generated by (3,5,6) happens to be the denominator of item 7 = (3 + 5 + 6)/2.

With[{mat=Append[zerosumgeometrysymmetric[[#,1]],1]&/@{3,5,6}}, 
TraditionalForm[Row[{Det[MatrixForm[mat]], " = ", Factor[Det[mat]]==0, "\n compare to ",Expand[-Denominator[zerosumgeometrysymmetric[[7,1,1]] ]]}]]]

But I should have expected this. The solution for 18 points is next. The point 9 is at infinity! Therefore, level 9 needs (1/0) to work properly.

zerosumGraphic[zerotripsymm[orchardsolutions[[18,4]],8], 18,2{260,210}]

Here’s a contour plot of all the orchard-planting polynomials up to order 28. The number values give the location of a particularly elegant solution for that number of points.

allorchardpolynomials=Table[orchardsolutions[[ff,5]]==0,{ff,11,27,2}];Graphics[{ContourPlot[Evaluate[allorchardpolynomials],{e,-3/2,2},{f,-3/2,2}, PlotPoints->100][[1]],Red,Table[Style[Text[n,Take[orchardsolutions[[n,4]],-2]],20],{n,11,28}]}]

Recall from the construction that e and f should not be 0 or 1, since that would cause all subsequent points to overlap on the first five points, causing degeneracy. The curves intersect at these values.

We can also plot the locations where the e f values lead to lines of two points having the same slope. Forcing parallelism leads to hundreds of extra curves. Do you see the lower-right corner where the green curve is passing through many black curves? That’s the location of the sporadic 16-point solution. It’s right there!

slope[{{x1_,y1_},{x2_,y2_}}]:= (y2-y1)/(x2-x1);
theslopes={#-1,FullSimplify[slope[Prepend[First/@Take[zerosumgeometrysymmetric,11],{0,0}][[#]]]]}&/@Subsets[Range[10],{2}];sameslope={#[[2,1]],#[[1]]}&/@(Transpose/@SplitBy[SortBy[{#[[1]],#[[2,1]]==Simplify[#[[2,2]]]}&/@({#[[1]],Flatten[#[[2]]]}&/@
SortBy[Flatten[Transpose[{Table[#[[1]],{Length[#[[2]]]}],(List@@@#&/@#[[2]])}]&/@Select[{#[[1]],Solve[{#[[2,1]]==#[[2,2]],d≠ ((b c)/a) ,e≠ 0, e≠1,f≠0,f≠1}]}&/@Take[SortBy[(Transpose/@Select[Subsets[theslopes,{2}], Length[Union[Flatten[First/@#]]]==4&]),Total[Flatten[#[[1]]]]&],150],Length[StringPosition[ToString[FullForm[#[[2]]]],"Complex"]]==0&&Length[#[[2]]]>0&],1],Last]),Last],Last]);
Graphics[{Table[ContourPlot[Evaluate[sameslope[[n,1]]],{e,-3/2,2},{f,-3/2,2}, PlotPoints->50,ContourStyle->Black][[1]],{n,1,162}],Red,Table[ContourPlot[Evaluate[allorchardpolynomials[[n]]],{e,-3/2,2},{f,-3/2,2}, PlotPoints->50,ContourStyle->Green][[1]],{n,1,18}],Tooltip[Point[#],#]&/@Tuples[Range[-6,6]/4,{2}] }]

That’s my way to find sporadic solutions. The mirror and skew plots have added levels of messiness sufficient to defy my current ability to analyze them.

Is there an easy way to generate these polynomials? I have no idea. Here are plots of their coefficient arrays.

Column[{Text@Grid[{Range[11,22],With[{array=CoefficientList[#,{e,f}]},With[{rule=Thread[Apply[Range,MinMax[Flatten[array]]]->
Join[Reverse[Table[ RGBColor[1,1-z/Abs[Min[Flatten[array]]],1-z/Abs[Min[Flatten[array]]]],{z,1,Abs[Min[Flatten[array]]]}]],
{RGBColor[1,1,1]},Table[ RGBColor[1-z/Abs[Max[Flatten[array]]],1,1],{z,1,Abs[Max[Flatten[array]]]}]]]},
ArrayPlot[array,ColorRules->rule, ImageSize-> Reverse[Dimensions[array]]{7,7},Frame-> False ]]]&/@(#[[5]]&/@Take[orchardsolutions,{11,22}])},Frame-> All],
Text@Grid[{Range[23,28],With[{array=CoefficientList[#,{e,f}]},With[{rule=Thread[Apply[Range,MinMax[Flatten[array]]]->
Join[Reverse[Table[ RGBColor[1,1-z/Abs[Min[Flatten[array]]],1-z/Abs[Min[Flatten[array]]]],{z,1,Abs[Min[Flatten[array]]]}]],
{RGBColor[1,1,1]},Table[ RGBColor[1-z/Abs[Max[Flatten[array]]],1,1],{z,1,Abs[Max[Flatten[array]]]}]]]},
ArrayPlot[array,ColorRules->rule, ImageSize-> Reverse[Dimensions[array]]{7,7},Frame-> False ]]]&/@(#[[5]]&/@Take[orchardsolutions,{23,28}])},Frame-> All]}, Alignment-> Center]

Graphics of Orchard Solutions

Grid[Partition[Table[Quiet@
zerosumGraphic[If[orchardsolutions[[n,2]]>orchardsolutions[[n,3]],orchardsolutions[[n,6]],Quiet@zerotripsymm[orchardsolutions[[n,4]],Floor[(n-1)/2]]], n,{260,210}],{n,9,28}],2]]

Unsolved Problems

1. Do more sporadic solutions exist for the three-orchard problem?
2. Can 11- and 19-point solutions be found with partial zero-sum geometry?
3. Do better solutions exist for four-orchard solutions on 17 or more points?
4. Do smaller 3- and 4-configurations exist where the sets of the barycentric coordinates for the points and lines are the same?
5. Does a 5-configuration exist where the sets of the barycentric coordinates for the points and lines are the same?
6. What are best solutions for the five-orchard problem?
7. Is there a good method for generating orchard-planting polynomials?

In the full notebook, you can see the code used for finding elegant-looking solutions.

Method to Find Elegant Solutions

First set the number of points. Generate a few hundred solutions based on the orchard-planting polynomial.

num=21;

tocheck=Monitor[SortBy[Union[
Select[RootReduce[Flatten[With[{poly=Expand[orchardsolutions[[num,5]]]},Table[{
With[
{case=Select[f/.Solve[(poly/.e-> frac[[ff]])==0],Im[#]==0&]},Transpose[{Table[frac[[ff]],{Length[case]}], case}]],
With[{case=Select[e/.Solve[(poly/.f-> frac[[ff]])==0],Im[#]==0&]},Transpose[{case,Table[frac[[ff]],{Length[case]}]}]]},{ff,1,Length[frac]}]],2]],Max[Abs[#]]<2&]], Max[Abs[CoefficientList[Select[#,Head[#]==Root&][[1,1]][x],x]]]&],ff];

Sort by the ratio of the farthest/nearest points; this ratio should be relatively low in a nice solution.

neworder=First/@SortBy[Table[With[
{minmax=MinMax[EuclideanDistance@@#&/@Subsets[Append[Flatten[N[zerotripsymm[Join[{1,1,-1,1}, tocheck[[hh]]],Floor[(num-1)/2]]],1],{0,0}],{2}]]},{Join[{1,1,-1,1}, tocheck[[hh]]],Last[minmax]/First[minmax]}],{hh,1,Length[tocheck]}],Last];

Move the points to make a square, then look at the order of the values by their closeness to (0,0). Pick out the different orderings that have the smallest ratios.

behaviors=SortBy[With[
{minmax=MinMax[EuclideanDistance@@#&/@Subsets[Append[Flatten[N[zerotripsymm[Flatten[{#[[2,2]],Take[neworder[[#[[1]]]],-2]}],Floor[(num-1)/2]]],1],{0,0}],{2}]]},{Flatten[{#[[2,2]],Take[neworder[[#[[1]]]],-2]}],Last[minmax]/First[minmax], #[[2,1]]}]&/@ Sort[First/@SplitBy[
SortBy[Table[{vv,With[{ord=First/@zerotripsymm[N[neworder[[vv]]],Floor[(num-1)/2]]},{Flatten[Position[ord,#]&/@SortBy[ord,-Norm[#]&]], nearestRational[#, 99]&/@abcdReplacement[Take[SortBy[ord,-Norm[#]&],2]]}]},{vv,1,Length[neworder]}],Last],#[[2,1]]&]],#[[2]]&];

Have a human look at the more promising results. Your tastes may vary. Do we go for the simpler generating polynomial or the more even spread of points?

Table[Column[{qq,behaviors[[qq,1]],zerosumGraphic[zerotripsymm[N[behaviors[[qq,1]]],Floor[(num-1)/2]], num]},Alignment->Center],{qq,1,5,2}]

That concludes my method for finding elegant-looking solutions for the orchard-planting problem.

Master List of Orchard Solutions

Solutions for the orchard-planting problem. 
1. Number of trees.
2. Best-known number of lines.
3. Number of lines with zero-sum geometries.
4. An elegant solution with six parameter zero-sum parameters.
5. The orchard-planting polynomial. 
6. Vertex positions of sporadic solution, if necessary.

orchardsolutions=
{{1,0,0,0,0},{2,0,0,0,0},{3,1,1,0,0},{4,1,1,0,0},{5,2,1,0,0},{6,4,3,0,0},{7,6,5,0,0,{{0,-(1/2)},{0,0},{0,1},{-((Sqrt[3])/2),-(1/2)},{-((Sqrt[3])/4),(1/4)},{((Sqrt[3])/4),(1/4)},{((Sqrt[3])/2),-(1/2)}}},{8,7,6,0,0,{{0,-(1/2)},{0,1},{-((Sqrt[3])/2),-(1/2)},{-((Sqrt[3])/4),(1/4)},{-((Sqrt[3])/8),-(1/8)},{((Sqrt[3])/8),-(1/8)},{((Sqrt[3])/4),(1/4)},{((Sqrt[3])/2),-(1/2)}}},{9,10,10,{1,1,-1,1,(1/2),(1/2)},e-f,{{-1,-1},{0,-1},{1,-1},{-(1/2),0},{0,0},{(1/2),0},{-1,1},{0,1},{1,1}}},{10,12,12,{(1/2),-1,(1/3),(2/3),(1/3),-(2/3)},-1+e-f,{{-1,-1},{-1,1},{-1,-2+(Sqrt[5])},{0,0},{0,(1/2) (-1+(Sqrt[5]))},{1,-1},{1,1},{1,-2+(Sqrt[5])},{-(1/(Sqrt[5])),(1/5) (-5+2 (Sqrt[5]))},{(1/(Sqrt[5])),(1/5) (-5+2 (Sqrt[5]))}}},{11,16,15,{1-(Sqrt[2]),-1,-(1/(Sqrt[2])),0,-1,(Sqrt[2])},e-(e^2)-f+(e^2) f-e (f^2),{{-1,-1},{-1,1},{-1,-2+(Sqrt[5])},{0,-1},{0,0},{0,(1/2) (-1+(Sqrt[5]))},{1,-1},{1,1},{1,-2+(Sqrt[5])},{-(1/(Sqrt[5])),-1+(2/(Sqrt[5]))},{(1/(Sqrt[5])),-1+(2/(Sqrt[5]))}}},{12,19,19,{1,-1,-(1/3),-1,-(1/2),(1/2)},-e+e f-(f^2)},{13,22,22,{1,1,-1,1,(1/224) (307-(Sqrt[28393])),(3/7)},-e+(e^2)+f-2 (e^2) f+e (f^2)+(e^2) (f^2)-e (f^3)},{14,26,26,{1,1,1,-1,(1/2),(1/4) (-1+(Sqrt[17]))},2 e-2 (e^2)-f+e f+(e^2) f-e (f^2)},{15,31,31,{5-2 (Sqrt[5]),9-4 (Sqrt[5]),1,1,(1/2) (1+(Sqrt[5])),-1},e-(e^2)-f+e f-(f^2)+e (f^2)-(f^3)},{16,37,37,{5-2 (Sqrt[5]),9-4 (Sqrt[5]),1,1,(1/2) (1+(Sqrt[5])),-1},-(e^2)+(e^3)+2 e f-2 (e^2) f-(e^3) f-(f^2)+3 (e^2) (f^2)-2 e (f^3),{{((2 (Sqrt[3])+2 (Sqrt[15]))/(6+2 (Sqrt[5]))),((-6+2 (Sqrt[5]))/(6+2 (Sqrt[5])))},{((2 (Sqrt[3])-2 (Sqrt[15]))/(6+2 (Sqrt[5]))),1},{-((4 (Sqrt[3]))/(6+2 (Sqrt[5]))),-((4 (Sqrt[5]))/(6+2 (Sqrt[5])))},{((-2 (Sqrt[3])+2 (Sqrt[15]))/(6+2 (Sqrt[5]))),1},{((-2 (Sqrt[3])-2 (Sqrt[15]))/(6+2 (Sqrt[5]))),((-6+2 (Sqrt[5]))/(6+2 (Sqrt[5])))},{((4 (Sqrt[3]))/(6+2 (Sqrt[5]))),-((4 (Sqrt[5]))/(6+2 (Sqrt[5])))},{((2 (Sqrt[3]))/(6+2 (Sqrt[5]))),((2 (Sqrt[5]))/(6+2 (Sqrt[5])))},{(((Sqrt[3]) (-1+(Sqrt[5])))/(6+2 (Sqrt[5]))),((-3-(Sqrt[5]))/(6+2 (Sqrt[5])))},{-(((Sqrt[3]) (1+(Sqrt[5])))/(6+2 (Sqrt[5]))),((3-(Sqrt[5]))/(6+2 (Sqrt[5])))},{-((2 (Sqrt[3]))/(6+2 (Sqrt[5]))),((2 (Sqrt[5]))/(6+2 (Sqrt[5])))},{(((Sqrt[3])+(Sqrt[15]))/(6+2 (Sqrt[5]))),((3-(Sqrt[5]))/(6+2 (Sqrt[5])))},{(((Sqrt[3])-(Sqrt[15]))/(6+2 (Sqrt[5]))),((-3-(Sqrt[5]))/(6+2 (Sqrt[5])))},{0,0}}},{17,40,40,{1,1,-1,1,Root[-2-11 #1+34 ((#1)^2)-28 ((#1)^3)+8 ((#1)^4)&,2],(1/2)},(e^2)-2 (e^3)+(e^4)-e f+2 (e^2) f+(e^3) f-2 (e^4) f-e (f^2)-3 (e^2) (f^2)+4 (e^3) (f^2)+(e^4) (f^2)+3 e (f^3)-3 (e^2) (f^3)-3 (e^3) (f^3)-(f^4)+e (f^4)+3 (e^2) (f^4)-e (f^5)},{18,46,46,{(25/47),-(22/31),1,(16/31),(1/2),Root[1-4 #1-5 ((#1)^2)+4 ((#1)^4)&,2]},-e+2 (e^2)-(e^3)+f-3 (e^2) f+2 (e^3) f+2 e (f^2)-(e^2) (f^2)-(e^3) (f^2)-e (f^3)+2 (e^2) (f^3)-e (f^4)},{19,52,51,{(17/36),-(12/47),-(19/72),-(59/94),-1,Root[-4+6 #1+10 ((#1)^2)-2 ((#1)^3)-4 ((#1)^4)+((#1)^5)+((#1)^6)&,2]},-(e^3)+2 (e^4)-(e^5)+(e^2) f-4 (e^4) f+3 (e^5) f-4 (e^2) (f^2)+8 (e^3) (f^2)-(e^4) (f^2)-3 (e^5) (f^2)+4 e (f^3)-5 (e^2) (f^3)-6 (e^3) (f^3)+6 (e^4) (f^3)+(e^5) (f^3)-(f^4)+e (f^4)+6 (e^2) (f^4)-3 (e^3) (f^4)-3 (e^4) (f^4)-2 e (f^5)+3 (e^3) (f^5)-(e^2) (f^6),{{0,0},{0,(2/5)},{-((Sqrt[3])/5),-(1/5)},{((Sqrt[3])/5),-(1/5)},{(1/5) Root[-1323+441 ((#1)^2)-42 ((#1)^4)+((#1)^6)&,3],(1/5) Root[7-21 #1+((#1)^3)&,1]},{(1/5) Root[-1323+441 ((#1)^2)-42 ((#1)^4)+((#1)^6)&,4],(1/5) Root[7-21 #1+((#1)^3)&,1]},{(1/5) Root[-1323+441 ((#1)^2)-42 ((#1)^4)+((#1)^6)&,1],(1/5) Root[7-21 #1+((#1)^3)&,2]},{(1/5) Root[-1323+441 ((#1)^2)-42 ((#1)^4)+((#1)^6)&,6],(1/5) Root[7-21 #1+((#1)^3)&,2]},{(1/5) Root[-1323+441 ((#1)^2)-42 ((#1)^4)+((#1)^6)&,2],(1/5) Root[7-21 #1+((#1)^3)&,3]},{(1/5) Root[-1323+441 ((#1)^2)-42 ((#1)^4)+((#1)^6)&,5],(1/5) Root[7-21 #1+((#1)^3)&,3]},{(1/5) Root[-1323+1764 ((#1)^2)-672 ((#1)^4)+64 ((#1)^6)&,2],(1/5) Root[-7-42 #1+8 ((#1)^3)&,1]},{(1/5) Root[-1323+1764 ((#1)^2)-672 ((#1)^4)+64 ((#1)^6)&,5],(1/5) Root[-7-42 #1+8 ((#1)^3)&,1]},{(1/5) Root[-1323+1764 ((#1)^2)-672 ((#1)^4)+64 ((#1)^6)&,1],(1/5) Root[-7-42 #1+8 ((#1)^3)&,2]},{(1/5) Root[-1323+1764 ((#1)^2)-672 ((#1)^4)+64 ((#1)^6)&,6],(1/5) Root[-7-42 #1+8 ((#1)^3)&,2]},{(1/5) Root[-1323+1764 ((#1)^2)-672 ((#1)^4)+64 ((#1)^6)&,3],(1/5) Root[-7-42 #1+8 ((#1)^3)&,3]},{(1/5) Root[-1323+1764 ((#1)^2)-672 ((#1)^4)+64 ((#1)^6)&,4],(1/5) Root[-7-42 #1+8 ((#1)^3)&,3]}}},{20,57,57,{-(58/85),(1/5),-(15/73),-1,(5/3),Root[-50+285 #1-453 ((#1)^2)+380 ((#1)^3)-168 ((#1)^4)+45 ((#1)^5)&,1]},-(e^2)+(e^3)+2 e f-3 (e^3) f-(f^2)-e (f^2)+2 (e^2) (f^2)+3 (e^3) (f^2)+e (f^3)-4 (e^2) (f^3)-(e^3) (f^3)-(f^4)+e (f^4)+2 (e^2) (f^4)-e (f^5)},{21,64,64,{1,1,-1,1,Root[-8+52 #1-177 ((#1)^2)+282 ((#1)^3)-204 ((#1)^4)+56 ((#1)^5)&,1],(1/2)},-3 (e^3)+6 (e^4)-3 (e^5)+6 (e^2) f-9 (e^3) f-3 (e^4) f+6 (e^5) f-4 e (f^2)+4 (e^2) (f^2)+12 (e^3) (f^2)-9 (e^4) (f^2)-4 (e^5) (f^2)+(f^3)-10 (e^2) (f^3)+3 (e^3) (f^3)+9 (e^4) (f^3)+(e^5) (f^3)+3 e (f^4)-6 (e^3) (f^4)-3 (e^4) (f^4)+(e^2) (f^5)+3 (e^3) (f^5)-(e^2) (f^6)},{22,70,70,{(71/69),(64/99),-1,1,(1/2),Root[-1+#1+2 ((#1)^2)+8 ((#1)^3)-6 ((#1)^4)-8 ((#1)^5)+8 ((#1)^6)&,2]},(e^2)-2 (e^3)+(e^4)-e f+2 (e^2) f-(e^4) f-e (f^2)+2 (e^2) (f^2)-(e^3) (f^2)-e (f^3)-2 (e^2) (f^3)+4 (e^3) (f^3)+4 e (f^4)-6 (e^2) (f^4)-(e^3) (f^4)-(f^5)+2 e (f^5)+2 (e^2) (f^5)-e (f^6)},{23,77,77,{-1,-(51/62),(11/45),-(5/11),Root[-597445632+3093795516 #1-6561755081 ((#1)^2)+9079691292 ((#1)^3)-9447228720 ((#1)^4)+6506395200 ((#1)^5)-2426112000 ((#1)^6)+373248000 ((#1)^7)&,1],(7/12)},(e^4)-3 (e^5)+3 (e^6)-(e^7)-4 (e^3) f+11 (e^4) f-7 (e^5) f-3 (e^6) f+3 (e^7) f+6 (e^2) (f^2)-12 (e^3) (f^2)-8 (e^4) (f^2)+26 (e^5) (f^2)-9 (e^6) (f^2)-3 (e^7) (f^2)-4 e (f^3)+4 (e^2) (f^3)+24 (e^3) (f^3)-32 (e^4) (f^3)-8 (e^5) (f^3)+15 (e^6) (f^3)+(e^7) (f^3)+(f^4)-17 (e^2) (f^4)+12 (e^3) (f^4)+28 (e^4) (f^4)-18 (e^5) (f^4)-6 (e^6) (f^4)+4 e (f^5)+(e^2) (f^5)-21 (e^3) (f^5)+7 (e^4) (f^5)+9 (e^5) (f^5)-e (f^6)+7 (e^2) (f^6)-3 (e^3) (f^6)-4 (e^4) (f^6)+(e^5) (f^6)-e (f^7)+3 (e^2) (f^7)-3 (e^4) (f^7)-e (f^8)+3 (e^3) (f^8)-(e^2) (f^9)},{24,85,85,{-(13/19),-1,-(9/23),(65/97),(1/2),Root[-1+23 ((#1)^2)-26 ((#1)^3)-64 ((#1)^4)+24 ((#1)^5)+48 ((#1)^6)&,1]},(e^3)-3 (e^4)+3 (e^5)-(e^6)-2 (e^2) f+7 (e^3) f-6 (e^4) f-(e^5) f+2 (e^6) f+e (f^2)-8 (e^2) (f^2)+7 (e^3) (f^2)+8 (e^4) (f^2)-7 (e^5) (f^2)-(e^6) (f^2)+5 e (f^3)-4 (e^2) (f^3)-15 (e^3) (f^3)+10 (e^4) (f^3)+5 (e^5) (f^3)-(f^4)+e (f^4)+11 (e^2) (f^4)-5 (e^3) (f^4)-10 (e^4) (f^4)-3 e (f^5)+9 (e^3) (f^5)-3 (e^2) (f^6)},{25,92,92,{(3/11),-(17/39),(29/79),(7/43),-1,Root[16+8 #1-40 ((#1)^2)+70 ((#1)^4)+39 ((#1)^5)-15 ((#1)^6)-18 ((#1)^7)-2 ((#1)^8)+3 ((#1)^9)+((#1)^10)&,2]},-(e^4)+4 (e^5)-6 (e^6)+4 (e^7)-(e^8)+4 (e^3) f-13 (e^4) f+11 (e^5) f+5 (e^6) f-11 (e^7) f+4 (e^8) f-6 (e^2) (f^2)+16 (e^3) (f^2)+3 (e^4) (f^2)-39 (e^5) (f^2)+29 (e^6) (f^2)+3 (e^7) (f^2)-6 (e^8) (f^2)+4 e (f^3)-10 (e^2) (f^3)-16 (e^3) (f^3)+49 (e^4) (f^3)-5 (e^5) (f^3)-43 (e^6) (f^3)+17 (e^7) (f^3)+4 (e^8) (f^3)-(f^4)+4 e (f^4)+9 (e^2) (f^4)-22 (e^3) (f^4)-36 (e^4) (f^4)+72 (e^5) (f^4)-6 (e^6) (f^4)-19 (e^7) (f^4)-(e^8) (f^4)-(f^5)+41 (e^3) (f^5)-54 (e^4) (f^5)-27 (e^5) (f^5)+36 (e^6) (f^5)+6 (e^7) (f^5)-(f^6)+3 e (f^6)-21 (e^2) (f^6)+22 (e^3) (f^6)+42 (e^4) (f^6)-35 (e^5) (f^6)-15 (e^6) (f^6)-(f^7)+6 e (f^7)-4 (e^2) (f^7)-30 (e^3) (f^7)+19 (e^4) (f^7)+20 (e^5) (f^7)-(f^8)+12 (e^2) (f^8)-6 (e^3) (f^8)-15 (e^4) (f^8)-2 e (f^9)+(e^2) (f^9)+6 (e^3) (f^9)-(e^2) (f^10)},{26,100,100,{-(40/89),(22/35),-(43/67),-(7/37),-1,Root[-8+12 #1+44 ((#1)^2)+12 ((#1)^3)-40 ((#1)^4)-28 ((#1)^5)+3 ((#1)^6)+6 ((#1)^7)+((#1)^8)&,4]},(e^4)-3 (e^5)+3 (e^6)-(e^7)-(e^3) f+(e^4) f+4 (e^5) f-7 (e^6) f+3 (e^7) f+7 (e^3) (f^2)-21 (e^4) (f^2)+18 (e^5) (f^2)-(e^6) (f^2)-3 (e^7) (f^2)-10 (e^2) (f^3)+24 (e^3) (f^3)-6 (e^4) (f^3)-19 (e^5) (f^3)+10 (e^6) (f^3)+(e^7) (f^3)+5 e (f^4)-10 (e^2) (f^4)-15 (e^3) (f^4)+35 (e^4) (f^4)-10 (e^5) (f^4)-5 (e^6) (f^4)-(f^5)+e (f^5)+15 (e^2) (f^5)-25 (e^3) (f^5)+10 (e^5) (f^5)-4 e (f^6)+8 (e^2) (f^6)+5 (e^3) (f^6)-10 (e^4) (f^6)-e (f^7)-2 (e^2) (f^7)+5 (e^3) (f^7)-(e^2) (f^8)},{27,109,109,{1,1,1,-1,(7/8),Root[-2401-34986 #1-59143 ((#1)^2)+628236 ((#1)^3)-209223 ((#1)^4)-6787914 ((#1)^5)+19392639 ((#1)^6)-23167592 ((#1)^7)+27927936 ((#1)^8)-18027520 ((#1)^9)-10637312 ((#1)^10)+11239424 ((#1)^11)&,3]},(e^4)-4 (e^5)+6 (e^6)-4 (e^7)+(e^8)-3 (e^3) f+9 (e^4) f-3 (e^5) f-15 (e^6) f+18 (e^7) f-6 (e^8) f+3 (e^2) (f^2)-7 (e^3) (f^2)-8 (e^4) (f^2)+24 (e^5) (f^2)+4 (e^6) (f^2)-31 (e^7) (f^2)+15 (e^8) (f^2)-e (f^3)+3 (e^2) (f^3)+6 (e^3) (f^3)-(e^4) (f^3)-47 (e^5) (f^3)+45 (e^6) (f^3)+15 (e^7) (f^3)-20 (e^8) (f^3)-e (f^4)-12 (e^3) (f^4)+33 (e^4) (f^4)+24 (e^5) (f^4)-84 (e^6) (f^4)+25 (e^7) (f^4)+15 (e^8) (f^4)-e (f^5)+6 (e^2) (f^5)+7 (e^3) (f^5)-73 (e^4) (f^5)+69 (e^5) (f^5)+40 (e^6) (f^5)-42 (e^7) (f^5)-6 (e^8) (f^5)-e (f^6)-16 (e^2) (f^6)+51 (e^3) (f^6)+3 (e^4) (f^6)-92 (e^5) (f^6)+30 (e^6) (f^6)+24 (e^7) (f^6)+(e^8) (f^6)+7 e (f^7)-15 (e^2) (f^7)-33 (e^3) (f^7)+67 (e^4) (f^7)+15 (e^5) (f^7)-36 (e^6) (f^7)-5 (e^7) (f^7)-(f^8)+2 e (f^8)+18 (e^2) (f^8)-23 (e^3) (f^8)-30 (e^4) (f^8)+24 (e^5) (f^8)+10 (e^6) (f^8)-3 e (f^9)+3 (e^2) (f^9)+15 (e^3) (f^9)-6 (e^4) (f^9)-10 (e^5) (f^9)-3 (e^2) (f^10)+5 (e^4) (f^10)-(e^3) (f^11)},
{28,117,117,{(31/41),(19/91),-(5/41),(55/91),-1,Root[-16+26 ((#1)^2)+((#1)^3)-6 ((#1)^4)+8 ((#1)^5)-8 ((#1)^6)-14 ((#1)^7)+4 ((#1)^9)+((#1)^10)&,4]},2 (e^4)-6 (e^5)+6 (e^6)-2 (e^7)-6 (e^3) f+14 (e^4) f-2 (e^5) f-14 (e^6) f+8 (e^7) f+7 (e^2) (f^2)-11 (e^3) (f^2)-21 (e^4) (f^2)+37 (e^5) (f^2)+(e^6) (f^2)-13 (e^7) (f^2)-4 e (f^3)+2 (e^2) (f^3)+33 (e^3) (f^3)-28 (e^4) (f^3)-39 (e^5) (f^3)+26 (e^6) (f^3)+11 (e^7) (f^3)+(f^4)+e (f^4)-20 (e^2) (f^4)+3 (e^3) (f^4)+53 (e^4) (f^4)-5 (e^5) (f^4)-34 (e^6) (f^4)-5 (e^7) (f^4)+5 e (f^5)+4 (e^2) (f^5)-29 (e^3) (f^5)-20 (e^4) (f^5)+35 (e^5) (f^5)+20 (e^6) (f^5)+(e^7) (f^5)-e (f^6)+7 (e^2) (f^6)+15 (e^3) (f^6)-10 (e^4) (f^6)-30 (e^5) (f^6)-5 (e^6) (f^6)-e (f^7)-2 (e^2) (f^7)-5 (e^3) (f^7)+20 (e^4) (f^7)+10 (e^5) (f^7)-e (f^8)+4 (e^2) (f^8)-5 (e^3) (f^8)-10 (e^4) (f^8)-e (f^9)+5 (e^3) (f^9)-(e^2) (f^10)}};

Initializations

nearestRational[number_, level_]:=If[Sign[number]==1,Floor[number]+Nearest[FareySequence[level],Mod[number,1]][[1]],Ceiling[number]-Nearest[FareySequence[level],Mod[1-number,1]][[1]]];

slope[{{x1_,y1_},{x2_,y2_}}]:= If[Chop[N[x1]-N[x2]]==0, Infinity,N[(y2-y1)/(x2-x1)] ];

fareys=Union[Flatten[Table[FareySequence[99]+n,{n,-3,2}]]];

frac=Complement[Union[Join[-1-FareySequence[17],-FareySequence[17],FareySequence[17],FareySequence[17]+1]],{0,1}];

abcdReplacement[{{a_,b_},{c_,d_}}]:=Flatten[{{((a-b+c-d)/(-b c+a d)),((a-b-c+d)/(-b c+a d))},{((a+b+c+d)/(-b c+a d)),((a+b-c-d)/(-b c+a d))}}];

zerosumGraphic[ptpairs_, num_, imsize_:{260,210}]:=Module[{tripleQ,pts,atInfinity,size,textsize,range, linesof3,linesof2},
If[Length[Dimensions[ptpairs]]==3, 
tripleQ=True;pts=Sort[Append[Flatten[ptpairs,1],{0,0}]],
tripleQ=False;pts=Sort[ptpairs] ];
atInfinity=num-Length[pts];
linesof3=Select[Subsets[pts,{3}],Chop[Quiet@Abs[Det[N[Append[#,1]]&/@#]]]==0&];
linesof2 =If[atInfinity>0,Take[First[Transpose[#]]&/@SortBy[SplitBy[SortBy[{#,slope[#]}&/@
Complement[Subsets[pts,{2}],Flatten[Subsets[#,{2}]&/@linesof3,1]],Round[Last[#]10^6]&],Round[Last[#]10^6]&],-Length[#]&],atInfinity],{}];
size=With[{dist=EuclideanDistance@@#&/@Subsets[N[pts],{2}]},Min[{.14,Min[dist]/2}]/If[tripleQ,1,2]];
textsize=If[imsize[[1]]>300,1.5If[size<.14,10,16],If[size<.14,10,16]];
range=MinMax/@Transpose[pts];
Column[{Text@Row[{num, " points on ", Length[linesof3]+Total[Length/@linesof2]+If[atInfinity==3,1,0], " lines", If[num>Length[pts],
Row[{" with ",If[tripleQ, Graphics[{Black,Circle[{0,0},1],
Style[Text[num/2,{0,0}],Green,12, Bold]},ImageSize-> {22,22}],Graphics[{Green,Circle[{0,0},.4],Red,Circle[{1,0},.4],Blue,Circle[{2,0},.4]},ImageSize-> {60,20}]]," at infinity"}], Sequence@@{}]}],
Graphics[{Black,EdgeForm[{Black, Thick}],Line/@linesof3,
If[num>Length[pts],{Last[#],InfiniteLine[#]&/@First[#]}&/@Transpose[{linesof2,Take[{Green,Red,Blue}, atInfinity]}], Sequence@@{}],White,Disk[#,.95 size]&/@N[pts],
If[tripleQ,
{{Style[Text[0,{0,0}],Green,textsize]},Table[{Style[Text[v,ptpairs[[v,w]]],{Blue,Red}[[w]],textsize]},{v,1,Length[ptpairs]},{w,1,2}]},Sequence@@{}]},
ImageSize-> imsize,PlotRange->{{range[[1,1]]-.4,range[[1,2]]+.4},{range[[2,1]]-.15,range[[2,2]]+.15}} ]}, Alignment-> Center]];

tri={{Sqrt[3],-1},{0,2},{-Sqrt[3],-1}};

ToBarycentrics[{{x1_,y1_},{x2_,y2_},{x3_,y3_}},{p_,q_}]:=Solve[{m*x1+n*x2+(1-m-n)*x3,m*y1+n*y2+(1-m-n)*y3}=={p,q}];

FromBarycentrics[{m_,n_},{{x1_,y1_},{x2_,y2_},{x3_,y3_}}]:={m*x1+n*x2+(1-m-n)*x3,m*y1+n*y2+(1-m-n)*y3};

BaryLiner[{pt1_,pt2_}]:=Module[{a,b},If[Det[{pt1,pt2,{1,1,1}/3}]≠0,{a,b,1-a-b}/.Solve[{a,b,1-a-b}.#==0&/@{pt1,pt2}][[1]],If[pt1[[1]]≠pt1[[2]],{a,-1-a,1}/.Solve[{a,-1-a,1}.#==0&/@{pt1,pt2}][[1]],{1,-1,0}]]];

lineintersect[{{a1_,b1_,c1_},{a2_,b2_,c2_}}]:=With[{init={b1 c2-b2 c1,a2 c1-a1 c2,a1 b2-a2 b1}},If[Total[init]==0,init,init/Total[init]]];

zerosumgeometrysymmetric={#,-#}&/@{{a,b},{c,d},{c (-1+e)-a e,d (-1+e)-b e},{c (-1+e) (-1+f)+a (e-(1+e) f),d (-1+e) (-1+f)+b (e-(1+e) f)},{((c (-1+e) (-1+f)-a e f)/(-1+e-f)),((d (-1+e) (-1+f)-b e f)/(-1+e-f))},{((-c (-1+f) f+a (e (-1+f)+f))/(e-e f+(f^2))),((-d (-1+f) f+b (e (-1+f)+f))/(e-e f+(f^2)))},{(((c-c e+a e (e-f)) f)/(-e (-1+e-f) (-2+f)+f)),(((d-d e+b e (e-f)) f)/(-e (-1+e-f) (-2+f)+f))},{((-c (-1+e) (e-f) f+a e (-1+e-f) (e (-1+f)+f))/((e^3) (-1+f)+(f^2)+(e^2) (1+(2-3 f) f)+2 e f (-1+(f^2)))),((-d (-1+e) (e-f) f+b e (-1+e-f) (e (-1+f)+f))/((e^3) (-1+f)+(f^2)+(e^2) (1+(2-3 f) f)+2 e f (-1+(f^2))))},{(((e-f) (-c (-1+e) (-1+e-f) (-1+f)-a f (f+e (-1+e-e f+(f^2)))))/(e-f+e (-2+e-f) (-1+f) (e (-1+f)-(f^2)))),(((e-f) (-d (-1+e) (-1+e-f) (-1+f)-b f (f+e (-1+e-e f+(f^2)))))/(e-f+e (-2+e-f) (-1+f) (e (-1+f)-(f^2))))},{-(((-1+e-f) (c (e-f) (e (-1+e-f) (-1+f)-f) (-1+f)-a e (e (-1+f)+f) (e (-1+f)-(f^2))))/((e^3) (((-1+f))^3)+(f^2)+(f^4)+(e^2) (1-2 (((-1+f))^2) (f^2))+e f (-2+(((-1+f))^2) f (1+f)))),-(((-1+e-f) (d (e-f) (e (-1+e-f) (-1+f)-f) (-1+f)-b e (e (-1+f)+f) (e (-1+f)-(f^2))))/((e^3) (((-1+f))^3)+(f^2)+(f^4)+(e^2) (1-2 (((-1+f))^2) (f^2))+e f (-2+(((-1+f))^2) f (1+f))))},{-(((e (-1+e-f) (-1+f)-f) (c (-1+e) (-1+e-f) (-1+f) (e (-1+f)-(f^2))-a (e-f) (f+e (-1+e (((-1+f))^2)+(f^2)-(f^3)))))/((e^4) (-1+f)+(f^5)+(e^3) (2+(f^2)-4 (f^3)+(f^4))+e f (1+f+(f^2)+(f^3) (-4+(-2+f) f))-(e^2) (1+2 f (1+f+(f^2) (-1+(-3+f) f))))),-(((e (-1+e-f) (-1+f)-f) (d (-1+e) (-1+e-f) (-1+f) (e (-1+f)-(f^2))-b (e-f) (f+e (-1+e (((-1+f))^2)+(f^2)-(f^3)))))/((e^4) (-1+f)+(f^5)+(e^3) (2+(f^2)-4 (f^3)+(f^4))+e f (1+f+(f^2)+(f^3) (-4+(-2+f) f))-(e^2) (1+2 f (1+f+(f^2) (-1+(-3+f) f)))))},{((e (-1+f)-(f^2)) (a e (-1+e-f) (e (-1+e-f) (-2+f)-f) f (e (-1+f)+f)-c (-1+e) (e (-1+e-f) (-1+f)-f) (f+e (-1+e (((-1+f))^2)+(f^2)-(f^3)))))/((((-1+e))^3) (e^3)-(((-1+e))^2) (e^2) (2+e) (-1+2 e) f+(-1+e) e (1-7 e+8 (e^3)+(e^4)) (f^2)+e (-5+e (4-5 (-1+e) e (3+e))) (f^3)+(1+e (-1+e (-11+5 e (1+2 e)))) (f^4)+3 e (1-3 (e^2)) (f^5)+3 (e^2) (f^6)),((e (-1+f)-(f^2)) (b e (-1+e-f) (e (-1+e-f) (-2+f)-f) f (e (-1+f)+f)-d (-1+e) (e (-1+e-f) (-1+f)-f) (f+e (-1+e (((-1+f))^2)+(f^2)-(f^3)))))/((((-1+e))^3) (e^3)-(((-1+e))^2) (e^2) (2+e) (-1+2 e) f+(-1+e) e (1-7 e+8 (e^3)+(e^4)) (f^2)+e (-5+e (4-5 (-1+e) e (3+e))) (f^3)+(1+e (-1+e (-11+5 e (1+2 e)))) (f^4)+3 e (1-3 (e^2)) (f^5)+3 (e^2) (f^6))},{-(((f+e (-1+e (((-1+f))^2)+(f^2)-(f^3))) (c (-1+e) (e (-1+e-f) (-2+f)-f) f (e (-1+f)-(f^2))+a e (e (-1+e-f) (-1+f)-f) (f+(-1+e-f) (e-(f^2)))))/((e^7) (((-1+f))^3)-(f^5)+(e^4) (1+f-21 (f^2)-6 (f^3)+35 (f^4)-10 (f^6))+e (f^4) (5+f-(f^2) (4+f))-(e^6) (-3+f (7+f+5 (-2+f) (f^2)))+(e^5) (-1+f) (3+f (-1-19 f+10 (f^3)))+(e^3) (-1+f) f (1+f (-6+5 f (2+f) (-3+(f^2))))-(e^2) (-1+f) (f^3) (-10+f (-20+f (-5+f (3+f)))))),-(((f+e (-1+e (((-1+f))^2)+(f^2)-(f^3))) (d (-1+e) (e (-1+e-f) (-2+f)-f) f (e (-1+f)-(f^2))+b e (e (-1+e-f) (-1+f)-f) (f+(-1+e-f) (e-(f^2)))))/((e^7) (((-1+f))^3)-(f^5)+(e^4) (1+f-21 (f^2)-6 (f^3)+35 (f^4)-10 (f^6))+e (f^4) (5+f-(f^2) (4+f))-(e^6) (-3+f (7+f+5 (-2+f) (f^2)))+(e^5) (-1+f) (3+f (-1-19 f+10 (f^3)))+(e^3) (-1+f) f (1+f (-6+5 f (2+f) (-3+(f^2))))-(e^2) (-1+f) (f^3) (-10+f (-20+f (-5+f (3+f))))))}};

zerotripsymm[{a_,b_,c_,d_,e_,f_},n_]:={#,-#}&/@Take[{{a,b},{c,d},{c (-1+e)-a e,d (-1+e)-b e},{c (-1+e) (-1+f)+a (e-(1+e) f),d (-1+e) (-1+f)+b (e-(1+e) f)},{((c (-1+e) (-1+f)-a e f)/(-1+e-f)),((d (-1+e) (-1+f)-b e f)/(-1+e-f))},{((-c (-1+f) f+a (e (-1+f)+f))/(e-e f+(f^2))),((-d (-1+f) f+b (e (-1+f)+f))/(e-e f+(f^2)))},{(((c-c e+a e (e-f)) f)/(-e (-1+e-f) (-2+f)+f)),(((d-d e+b e (e-f)) f)/(-e (-1+e-f) (-2+f)+f))},{((-c (-1+e) (e-f) f+a e (-1+e-f) (e (-1+f)+f))/((e^3) (-1+f)+(f^2)+(e^2) (1+(2-3 f) f)+2 e f (-1+(f^2)))),((-d (-1+e) (e-f) f+b e (-1+e-f) (e (-1+f)+f))/((e^3) (-1+f)+(f^2)+(e^2) (1+(2-3 f) f)+2 e f (-1+(f^2))))},{((e-f) (-c (-1+e) (-1+e-f) (-1+f)-a f (f+e (-1+e-e f+(f^2)))))/(e-f+e (-2+e-f) (-1+f) (e (-1+f)-(f^2))),((e-f) (-d (-1+e) (-1+e-f) (-1+f)-b f (f+e (-1+e-e f+(f^2)))))/(e-f+e (-2+e-f) (-1+f) (e (-1+f)-(f^2)))},{-(((-1+e-f) (c (e-f) (e (-1+e-f) (-1+f)-f) (-1+f)-a e (e (-1+f)+f) (e (-1+f)-(f^2))))/((e^3) (((-1+f))^3)+(f^2)+(f^4)+(e^2) (1-2 (((-1+f))^2) (f^2))+e f (-2+(((-1+f))^2) f (1+f)))),-(((-1+e-f) (d (e-f) (e (-1+e-f) (-1+f)-f) (-1+f)-b e (e (-1+f)+f) (e (-1+f)-(f^2))))/((e^3) (((-1+f))^3)+(f^2)+(f^4)+(e^2) (1-2 (((-1+f))^2) (f^2))+e f (-2+(((-1+f))^2) f (1+f))))},{-(((e (-1+e-f) (-1+f)-f) (c (-1+e) (-1+e-f) (-1+f) (e (-1+f)-(f^2))-a (e-f) (f+e (-1+e (((-1+f))^2)+(f^2)-(f^3)))))/((e^4) (-1+f)+(f^5)+(e^3) (2+(f^2)-4 (f^3)+(f^4))+e f (1+f+(f^2)+(f^3) (-4+(-2+f) f))-(e^2) (1+2 f (1+f+(f^2) (-1+(-3+f) f))))),-(((e (-1+e-f) (-1+f)-f) (d (-1+e) (-1+e-f) (-1+f) (e (-1+f)-(f^2))-b (e-f) (f+e (-1+e (((-1+f))^2)+(f^2)-(f^3)))))/((e^4) (-1+f)+(f^5)+(e^3) (2+(f^2)-4 (f^3)+(f^4))+e f (1+f+(f^2)+(f^3) (-4+(-2+f) f))-(e^2) (1+2 f (1+f+(f^2) (-1+(-3+f) f)))))},{((e (-1+f)-(f^2)) (a e (-1+e-f) (e (-1+e-f) (-2+f)-f) f (e (-1+f)+f)-c (-1+e) (e (-1+e-f) (-1+f)-f) (f+e (-1+e (((-1+f))^2)+(f^2)-(f^3)))))/((((-1+e))^3) (e^3)-(((-1+e))^2) (e^2) (2+e) (-1+2 e) f+(-1+e) e (1-7 e+8 (e^3)+(e^4)) (f^2)+e (-5+e (4-5 (-1+e) e (3+e))) (f^3)+(1+e (-1+e (-11+5 e (1+2 e)))) (f^4)+3 e (1-3 (e^2)) (f^5)+3 (e^2) (f^6)),((e (-1+f)-(f^2)) (b e (-1+e-f) (e (-1+e-f) (-2+f)-f) f (e (-1+f)+f)-d (-1+e) (e (-1+e-f) (-1+f)-f) (f+e (-1+e (((-1+f))^2)+(f^2)-(f^3)))))/((((-1+e))^3) (e^3)-(((-1+e))^2) (e^2) (2+e) (-1+2 e) f+(-1+e) e (1-7 e+8 (e^3)+(e^4)) (f^2)+e (-5+e (4-5 (-1+e) e (3+e))) (f^3)+(1+e (-1+e (-11+5 e (1+2 e)))) (f^4)+3 e (1-3 (e^2)) (f^5)+3 (e^2) (f^6))},{-(((f+e (-1+e (((-1+f))^2)+(f^2)-(f^3))) (c (-1+e) (e (-1+e-f) (-2+f)-f) f (e (-1+f)-(f^2))+a e (e (-1+e-f) (-1+f)-f) (f+(-1+e-f) (e-(f^2)))))/((e^7) (((-1+f))^3)-(f^5)+(e^4) (1+f-21 (f^2)-6 (f^3)+35 (f^4)-10 (f^6))+e (f^4) (5+f-(f^2) (4+f))-(e^6) (-3+f (7+f+5 (-2+f) (f^2)))+(e^5) (-1+f) (3+f (-1-19 f+10 (f^3)))+(e^3) (-1+f) f (1+f (-6+5 f (2+f) (-3+(f^2))))-(e^2) (-1+f) (f^3) (-10+f (-20+f (-5+f (3+f)))))),-(((f+e (-1+e (((-1+f))^2)+(f^2)-(f^3))) (d (-1+e) (e (-1+e-f) (-2+f)-f) f (e (-1+f)-(f^2))+b e (e (-1+e-f) (-1+f)-f) (f+(-1+e-f) (e-(f^2)))))/((e^7) (((-1+f))^3)-(f^5)+(e^4) (1+f-21 (f^2)-6 (f^3)+35 (f^4)-10 (f^6))+e (f^4) (5+f-(f^2) (4+f))-(e^6) (-3+f (7+f+5 (-2+f) (f^2)))+(e^5) (-1+f) (3+f (-1-19 f+10 (f^3)))+(e^3) (-1+f) f (1+f (-6+5 f (2+f) (-3+(f^2))))-(e^2) (-1+f) (f^3) (-10+f (-20+f (-5+f (3+f))))))}},n];

zerosumgeometrymirror={#,Reverse[#]}&/@{{a,b},{c,d},{d (1-e)+b e,c (1-e)+a e},{(c (1-e)+a e) (1-f)+b f,(d (1-e)+b e) (1-f)+a f},{((d^2) (((-1+e))^2) (-1+f)+a (a-b) e f+(a-b) d (-1+e) (e (-1+f)+f)-c (-1+e) (d (-1+e) (-1+f)+(a-b) f))/((a-b) e (1+e (-1+f))-c (((-1+e))^2) (-1+f)+d (((-1+e))^2) (-1+f)),(-(c^2) (((-1+e))^2) (-1+f)+(a-b) (d+b e-d e) f+c (-1+e) (d (-1+e) (-1+f)+(a-b) (e (-1+f)+f)))/((a-b) e (1+e (-1+f))-c (((-1+e))^2) (-1+f)+d (((-1+e))^2) (-1+f))},
{((b^2) e (-1+f) (-d e (-1+f)+c (e (-1+f)+f))+a f (c d (-1+e) (-1+f)-a d f+a c (e (-1+f)+f)+(c^2) (-1+e+f-e f))+b ((c^2) (-1+e) e (((-1+f))^2)-c (d (-1+e) (2 e (-1+f)-f) (-1+f)+a (((e (-1+f)+f))^2))+d (d (-1+e) (e (-1+f)-f) (-1+f)+a ((e^2) (((-1+f))^2)+(f^2)))))/((c^2) (-1+e) (e (-1+f)-f) (-1+f)+(((a-b))^2) e (-1+f) f+(d^2) (-1+e) (-1+f) (-e+(-1+e) f)+(a-b) d (f+(-e+(-1+e) f) (-e+(2+e) f))+c (-2 d (-1+e) (-1+f) (-e+(-1+e) f)-(a-b) (f+(-e+(-1+e) f) (-e+(2+e) f)))),(b f (c d (-1+e) (-1+f)-b c f+b d (e (-1+f)+f)+(d^2) (-1+e+f-e f))-(a^2) e (-1+f) (c e (-1+f)+d (e-(1+e) f))+a ((c^2) (-1+e) (e (-1+f)-f) (-1+f)+d (d (-1+e) e (((-1+f))^2)-b (((e (-1+f)+f))^2))+c (-d (-1+e) (2 e (-1+f)-f) (-1+f)+b ((e^2) (((-1+f))^2)+(f^2)))))/((c^2) (-1+e) (e (-1+f)-f) (-1+f)+(((a-b))^2) e (-1+f) f+(d^2) (-1+e) (-1+f) (-e+(-1+e) f)+(a-b) d (f+(-e+(-1+e) f) (-e+(2+e) f))+c (-2 d (-1+e) (-1+f) (-e+(-1+e) f)-(a-b) (f+(-e+(-1+e) f) (-e+(2+e) f))))},
{(-(c^3) (((-1+e))^3) (e (-1+f)-f) (-1+f)+(c^2) (((-1+e))^2) (d (-1+e) (3 e (-1+f)-2 f) (-1+f)+(a-b) (2 (e^2) (((-1+f))^2)-(f^2)))+e ((d^3) (((-1+e))^3) (((-1+f))^2)-(((a-b))^2) b (e^2) (-1+f) f+2 (a-b) (d^2) (((-1+e))^2) (-1+f) (e (-1+f)+f)+(a-b) d (-1+e) (a (((e (-1+f)+f))^2)-b e (-1+f) (-e+(3+e) f)))-c (-1+e) ((d^2) (((-1+e))^2) (3 e (-1+f)-f) (-1+f)+(a-b) d (-1+e) (4 (e^2) (((-1+f))^2)+2 e (-1+f) f-(f^2))+(a-b) e (a e (-1+f) (e (-1+f)+f)+b (-(e^2) (((-1+f))^2)-2 e (-1+f) f+(f^2)))))/((-c (-1+e) ((a-b) (e (2+e (-1+f))-f)+2 d (((-1+e))^2) (-1+f))+(((a-b))^2) e (e-f)+(a-b) d (-1+e) (e (2+e (-1+f))-f)+(c^2) (((-1+e))^3) (-1+f)+(d^2) (((-1+e))^3) (-1+f)) f),-((-(c^3) (((-1+e))^3) e (((-1+f))^2)+(c^2) (((-1+e))^2) (-1+f) (d (-1+e) (3 e (-1+f)-f)+2 (a-b) e (e (-1+f)+f))+((d^2) (((-1+e))^2) (-1+f)+a (a-b) e f+(a-b) d (-1+e) (e (-1+f)+f)) ((a-b) (e^2) (-1+f)+d (-1+e) (-e+(-1+e) f))-c (-1+e) ((d^2) (((-1+e))^2) (3 e (-1+f)-2 f) (-1+f)+(a-b) d (-1+e) (4 (e^2) (((-1+f))^2)+2 e (-1+f) f-(f^2))+(a-b) e (-b (((e (-1+f)+f))^2)+a e (-1+f) (-e+(3+e) f))))/((-c (-1+e) ((a-b) (e (2+e (-1+f))-f)+2 d (((-1+e))^2) (-1+f))+(((a-b))^2) e (e-f)+(a-b) d (-1+e) (e (2+e (-1+f))-f)+(c^2) (((-1+e))^3) (-1+f)+(d^2) (((-1+e))^3) (-1+f)) f))}};

zerotripmirror[{a_,b_,c_,d_,e_,f_},n_]:={#,Reverse[#]}&/@Take[{{a,b},{c,d},{d (1-e)+b e,c (1-e)+a e},{(c (1-e)+a e) (1-f)+b f,(d (1-e)+b e) (1-f)+a f},{((d^2) (((-1+e))^2) (-1+f)+a (a-b) e f+(a-b) d (-1+e) (e (-1+f)+f)-c (-1+e) (d (-1+e) (-1+f)+(a-b) f))/((a-b) e (1+e (-1+f))-c (((-1+e))^2) (-1+f)+d (((-1+e))^2) (-1+f)),(-(c^2) (((-1+e))^2) (-1+f)+(a-b) (d+b e-d e) f+c (-1+e) (d (-1+e) (-1+f)+(a-b) (e (-1+f)+f)))/((a-b) e (1+e (-1+f))-c (((-1+e))^2) (-1+f)+d (((-1+e))^2) (-1+f))},
{((b^2) e (-1+f) (-d e (-1+f)+c (e (-1+f)+f))+a f (c d (-1+e) (-1+f)-a d f+a c (e (-1+f)+f)+(c^2) (-1+e+f-e f))+b ((c^2) (-1+e) e (((-1+f))^2)-c (d (-1+e) (2 e (-1+f)-f) (-1+f)+a (((e (-1+f)+f))^2))+d (d (-1+e) (e (-1+f)-f) (-1+f)+a ((e^2) (((-1+f))^2)+(f^2)))))/((c^2) (-1+e) (e (-1+f)-f) (-1+f)+(((a-b))^2) e (-1+f) f+(d^2) (-1+e) (-1+f) (-e+(-1+e) f)+(a-b) d (f+(-e+(-1+e) f) (-e+(2+e) f))+c (-2 d (-1+e) (-1+f) (-e+(-1+e) f)-(a-b) (f+(-e+(-1+e) f) (-e+(2+e) f)))),(b f (c d (-1+e) (-1+f)-b c f+b d (e (-1+f)+f)+(d^2) (-1+e+f-e f))-(a^2) e (-1+f) (c e (-1+f)+d (e-(1+e) f))+a ((c^2) (-1+e) (e (-1+f)-f) (-1+f)+d (d (-1+e) e (((-1+f))^2)-b (((e (-1+f)+f))^2))+c (-d (-1+e) (2 e (-1+f)-f) (-1+f)+b ((e^2) (((-1+f))^2)+(f^2)))))/((c^2) (-1+e) (e (-1+f)-f) (-1+f)+(((a-b))^2) e (-1+f) f+(d^2) (-1+e) (-1+f) (-e+(-1+e) f)+(a-b) d (f+(-e+(-1+e) f) (-e+(2+e) f))+c (-2 d (-1+e) (-1+f) (-e+(-1+e) f)-(a-b) (f+(-e+(-1+e) f) (-e+(2+e) f))))},
{(-(c^3) (((-1+e))^3) (e (-1+f)-f) (-1+f)+(c^2) (((-1+e))^2) (d (-1+e) (3 e (-1+f)-2 f) (-1+f)+(a-b) (2 (e^2) (((-1+f))^2)-(f^2)))+e ((d^3) (((-1+e))^3) (((-1+f))^2)-(((a-b))^2) b (e^2) (-1+f) f+2 (a-b) (d^2) (((-1+e))^2) (-1+f) (e (-1+f)+f)+(a-b) d (-1+e) (a (((e (-1+f)+f))^2)-b e (-1+f) (-e+(3+e) f)))-c (-1+e) ((d^2) (((-1+e))^2) (3 e (-1+f)-f) (-1+f)+(a-b) d (-1+e) (4 (e^2) (((-1+f))^2)+2 e (-1+f) f-(f^2))+(a-b) e (a e (-1+f) (e (-1+f)+f)+b (-(e^2) (((-1+f))^2)-2 e (-1+f) f+(f^2)))))/((-c (-1+e) ((a-b) (e (2+e (-1+f))-f)+2 d (((-1+e))^2) (-1+f))+(((a-b))^2) e (e-f)+(a-b) d (-1+e) (e (2+e (-1+f))-f)+(c^2) (((-1+e))^3) (-1+f)+(d^2) (((-1+e))^3) (-1+f)) f),-((-(c^3) (((-1+e))^3) e (((-1+f))^2)+(c^2) (((-1+e))^2) (-1+f) (d (-1+e) (3 e (-1+f)-f)+2 (a-b) e (e (-1+f)+f))+((d^2) (((-1+e))^2) (-1+f)+a (a-b) e f+(a-b) d (-1+e) (e (-1+f)+f)) ((a-b) (e^2) (-1+f)+d (-1+e) (-e+(-1+e) f))-c (-1+e) ((d^2) (((-1+e))^2) (3 e (-1+f)-2 f) (-1+f)+(a-b) d (-1+e) (4 (e^2) (((-1+f))^2)+2 e (-1+f) f-(f^2))+(a-b) e (-b (((e (-1+f)+f))^2)+a e (-1+f) (-e+(3+e) f))))/((-c (-1+e) ((a-b) (e (2+e (-1+f))-f)+2 d (((-1+e))^2) (-1+f))+(((a-b))^2) e (e-f)+(a-b) d (-1+e) (e (2+e (-1+f))-f)+(c^2) (((-1+e))^3) (-1+f)+(d^2) (((-1+e))^3) (-1+f)) f))}},n]

zerosumgeometryskew={{{a,b}(*1*),{m a,m b}(*-1*)},{ {c,d}(*2*), {n c,n d}(*-2*)}, 
{e{m a,m b} +(1-e){n c,n d}(*3*),{((a e m+c n-c e n)/(e m+n-e n)),((b e m+d n-d e n)/(e m+n-e n))}(*-3*)},
{{a f m-(((-1+f) (a e m-c (-1+e) n))/(e (m-n)+n)),b f m-(((-1+f) (b e m-d (-1+e) n))/(e (m-n)+n))}(*4*),{((c (-1+e) (-1+f) n+a m (e+e f (-1+m-n)+f n))/(1+f (-1+e m (m-n)+m n))),((d (-1+e) (-1+f) n+b m (e+e f (-1+m-n)+f n))/(1+f (-1+e m (m-n)+m n)))}(*-4*)},
{{(c (-1+e) (-1+f) n (-1+e (m-n)+n)+a e f (-1+m) m (e (m-n)+n))/(-1+f+e (1+m-e m+f (-1+(m^2) (-1+e m)))+n+(-f m+e (-2+e+e f m-2 (-1+e) f (m^2))) n+(((-1+e))^2) f (-1+m) (n^2)),(d (-1+e) (-1+f) n (-1+e (m-n)+n)+b e f (-1+m) m (e (m-n)+n))/(-1+f+e (1+m-e m+f (-1+(m^2) (-1+e m)))+n+(-f m+e (-2+e+e f m-2 (-1+e) f (m^2))) n+(((-1+e))^2) f (-1+m) (n^2))}(*5*),{((c (-1+e) (-1+f) n (-1+e (m-n)+n)+a e f (-1+m) m (e (m-n)+n))/(e f (-1+m) m+(-1+e) (-1+e m) (-1+f m) n-(((-1+e))^2) (-1+f m) (n^2))),((d (-1+e) (-1+f) n (-1+e (m-n)+n)+b e f (-1+m) m (e (m-n)+n))/(e f (-1+m) m+(-1+e) (-1+e m) (-1+f m) n-(((-1+e))^2) (-1+f m) (n^2)))}(*-5*)},
{{(c (-1+f) f (-1+m) n (-1+e (m-n)+n) (e (m-n)+n)+a m (-1+n) (e+e f (-1+m-n)+f n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n))))/(f (-1+n) n (1-f+m (-1+f m) n)+e ((-1+f) (1+f (-1+m))+(2+f (-2+m (1+m+f (-1+m-2 (m^2))))) n+(-1+f (-1-2 (m^2)+2 f (1+m (-1+m+(m^2))))) (n^2)-2 f m (-1+f m) (n^3))+(e^2) (m-n) (1-n+f (-1+m n (1-m+n)+f (n+m (-2 n+m (1+m (-1+n)+n-(n^2))))))),(d (-1+f) f (-1+m) n (-1+e (m-n)+n) (e (m-n)+n)+b m (-1+n) (e+e f (-1+m-n)+f n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n))))/(f (-1+n) n (1-f+m (-1+f m) n)+e ((-1+f) (1+f (-1+m))+(2+f (-2+m (1+m+f (-1+m-2 (m^2))))) n+(-1+f (-1-2 (m^2)+2 f (1+m (-1+m+(m^2))))) (n^2)-2 f m (-1+f m) (n^3))+(e^2) (m-n) (1-n+f (-1+m n (1-m+n)+f (n+m (-2 n+m (1+m (-1+n)+n-(n^2)))))))}(*6*),{(c (-1+f) f (-1+m) n (-1+e (m-n)+n) (e (m-n)+n)+a m (-1+n) (e+e f (-1+m-n)+f n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n))))/(e ((-1+f) m+(2 m-f (-1+f+m+f m (-1+2 m))) n+(-m+f (-2+m (f-m+3 f m))) (n^2)+2 f (f+m-2 f m) (n^3))+(e^2) (m-n) (-1+f n) (f (m^2)+f n+m (-1+n-2 f n))+f (-1+n) n (1-m n+f (-1-n+2 m n))),(d (-1+f) f (-1+m) n (-1+e (m-n)+n) (e (m-n)+n)+b m (-1+n) (e+e f (-1+m-n)+f n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n))))/(e ((-1+f) m+(2 m-f (-1+f+m+f m (-1+2 m))) n+(-m+f (-2+m (f-m+3 f m))) (n^2)+2 f (f+m-2 f m) (n^3))+(e^2) (m-n) (-1+f n) (f (m^2)+f n+m (-1+n-2 f n))+f (-1+n) n (1-m n+f (-1-n+2 m n)))}(*-6*)},
{{(f (e (m-n)+n) (a e (-1+m) m (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))-c (-1+e) n (-1+e (m-n)+n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n)))))/((e^3) (m-n) (2+m+f (-3+f-m+(-2+f) (m^2)+f (m^3))-5 n+(-m+f ((((2+m))^2)-f (-1+m+3 (m^2)))) n+(3-f (-2+m+2 f (2+(-1+m) m))) (n^2)+4 f (-1+f m) (n^3))+f (-1+n) (n^2) (1-n+f (-1+m n))-(e^4) (((m-n))^2) (1-n+f (-1+n) (1+m+n)+(f^2) ((m^2)+n-m n (1+n)))-e ((((-1+n))^3)+f (2-(4+m) n+(6+m) (n^3)-4 (n^4))+(f^2) (-1+n (1+m+(3+(-1+m) m) n-2 (2+m+(m^2)) (n^2)+4 m (n^3))))+(e^2) (-(1+2 m-3 n) (((-1+n))^2)+f (2+2 m (1+m)-7 n-4 m (1+m) n+(4+m+(m^2)) (n^2)+3 (2+m) (n^3)-6 (n^4))+(f^2) (-1+2 n+3 (1-2 n) (n^2)+6 m (n^4)+(m^3) n (1+n)-(m^2) (2+n (-3+n+6 (n^2)))))),(f (e (m-n)+n) (-d (-1+e) n (1-e m+(-1+e) n) (-1+f+e m-e f (m^2)+(-1+e) (-1+f m) n)+b e (-1+m) m (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))))/((e^3) (m-n) (2+m+f (-3+f-m+(-2+f) (m^2)+f (m^3))-5 n+(-m+f ((((2+m))^2)-f (-1+m+3 (m^2)))) n+(3-f (-2+m+2 f (2+(-1+m) m))) (n^2)+4 f (-1+f m) (n^3))+f (-1+n) (n^2) (1-n+f (-1+m n))-(e^4) (((m-n))^2) (1-n+f (-1+n) (1+m+n)+(f^2) ((m^2)+n-m n (1+n)))-e ((((-1+n))^3)+f (2-(4+m) n+(6+m) (n^3)-4 (n^4))+(f^2) (-1+n (1+m+(3+(-1+m) m) n-2 (2+m+(m^2)) (n^2)+4 m (n^3))))+(e^2) (-(1+2 m-3 n) (((-1+n))^2)+f (2+2 m (1+m)-7 n-4 m (1+m) n+(4+m+(m^2)) (n^2)+3 (2+m) (n^3)-6 (n^4))+(f^2) (-1+2 n+3 (1-2 n) (n^2)+6 m (n^4)+(m^3) n (1+n)-(m^2) (2+n (-3+n+6 (n^2))))))}(*7*),{-((f (e (m-n)+n) (a e (-1+m) m (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))-c (-1+e) n (-1+e (m-n)+n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n)))))/(-(e^3) (m-n) (-2-m+f (2+m (-1+(2+f (-1+m)) m))+5 n+(m-f (f+m+2 f (-1+m) m+4 (m^2))) n+(-3-4 f+f (6+f) m) (n^2))+(e^2) (-1-2 m+f (2+m+f (-1+m) (1+(m^2)))+5 n+(4 m-f (5+m (-3+f+4 m+f m (-1+3 m)))) n+(-7-2 m+f (-2+3 f-3 f m+(5+6 f) (m^2))) (n^2)-3 (-1-2 f+f (2+f) m) (n^3))+(e^4) (((m-n))^2) (-1+n+f ((m^2)+n-2 m n))-f (-1+n) n (1-n+f (-1+m n))+e (-(((-1+n))^3)+f (-1+n) (2-m+m n+2 (-2+m) (n^2))+(f^2) (1-m+n+2 (m^2) n-3 (1+(m^2)) (n^2)+3 m (n^3))))),-((f (e (m-n)+n) (-d (-1+e) n (1-e m+(-1+e) n) (-1+f+e m-e f (m^2)+(-1+e) (-1+f m) n)+b e (-1+m) m (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))))/(-(e^3) (m-n) (-2-m+f (2+m (-1+(2+f (-1+m)) m))+5 n+(m-f (f+m+2 f (-1+m) m+4 (m^2))) n+(-3-4 f+f (6+f) m) (n^2))+(e^2) (-1-2 m+f (2+m+f (-1+m) (1+(m^2)))+5 n+(4 m-f (5+m (-3+f+4 m+f m (-1+3 m)))) n+(-7-2 m+f (-2+3 f-3 f m+(5+6 f) (m^2))) (n^2)-3 (-1-2 f+f (2+f) m) (n^3))+(e^4) (((m-n))^2) (-1+n+f ((m^2)+n-2 m n))-f (-1+n) n (1-n+f (-1+m n))+e (-(((-1+n))^3)+f (-1+n) (2-m+m n+2 (-2+m) (n^2))+(f^2) (1-m+n+2 (m^2) n-3 (1+(m^2)) (n^2)+3 m (n^3)))))}(*-7*)},
{{((1-n+e (-m+n)+f (-1+e m (m-n)+m n)) (c (-1+e) f (-1+m) n (e (m-n)+n) (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))+a e m (f (-1+n) n (1-n+f (-1+(-1+2 m) n))+(e^3) (m-n) (-1+n+f (1+(m^2)+n-(n^2)-m (1+n))+(f^2) ((m^3)-n (1+n)+m n (3+2 n)-(m^2) (1+3 n)))+e (-(((-1+n))^2)+f (-1+n) (-2+m-2 n+3 (n^2))+(f^2) (-1-2 n+(n^2)+3 (n^3)+(m^2) n (-4+5 n)+m (1+3 n-6 (n^3))))+(e^2) (-(1+m-2 n) (-1+n)+f (-2+m+2 n-3 m n+4 (n^2)-3 (n^3)+(m^2) (-1+2 n))+(f^2) (1+n-2 (n^2)-3 (n^3)+(m^3) (-2+4 n)+(m^2) (3-10 (n^2))+m (-2-2 n+6 (n^2)+6 (n^3)))))))/((f^2) (-1+m) (-1+n) (n^2) (1-n+f (-1+m n))+(e^5) (((m-n))^2) ((f^3) (m^4)+f n (1-f+(f^2) n)+f (m^2) (1+(2-f+3 (f^2)) n+f (-2+3 f) (n^2))-f (m^3) (1-f n+(f^2) (1+3 n))+m (1-n+(f^2) (1+2 n)-(f^3) n (1+3 n)+f (-2-2 n+(n^2))))+e f (-1+n) n ((1+m (-2+n)) (-1+n)-2 f (-1+n) (1+2 n+(m^2) (1+n)-m (3+2 n))+(f^2) (-1-3 n+3 (m^3) n+(n^2)+m (((2+n))^2)-(m^2) (2+6 n+(n^2))))+(e^4) (m-n) ((f^2) (m^4) (2-n+f (-2+4 n))+f n (-2+4 n-f (-3+3 n+(n^2))+(f^2) (-1-n+4 (n^2)))+f (m^3) (2-4 n+(f^2) (2+3 n-13 (n^2))+f (-4-5 n+7 (n^2)))+m (-2+5 n-3 (n^2)+(f^3) (1+4 n-2 (n^2)-11 (n^3))+(f^2) (-5-3 n+9 (n^2)+(n^3))+2 f (3-3 n-5 (n^2)+2 (n^3)))+(m^2) (-1+n+f (-2+4 n+4 (n^2))+(f^2) (4+4 n-8 (n^3))+(f^3) (-1-6 n+8 (n^2)+11 (n^3))))+(e^2) (3 (f^3) (m^4) (-1+n) n+(f^2) (m^3) (-1+f-2 n+8 f n+9 (n^2)-9 f (n^2)-5 (n^3))-f n (2-6 n+4 (n^2)+2 (f^2) (((-1+n))^2) (1+2 n)+f (-4+6 n+5 (n^2)-6 (n^3)))-f (m^2) (2-6 n+4 (n^2)+f (-5+4 n+7 (n^2)+5 (n^3)-8 (n^4))+(f^2) (3+5 n-2 (n^2)-12 (n^3)+6 (n^4)))+m ((((-1+n))^3)-2 f (-2+3 n+4 (n^2)-7 (n^3)+2 (n^4))+(f^3) (2+6 n-8 (n^2)-6 (n^3)+6 (n^4))-(f^2) (5+3 n-25 (n^2)+8 (n^3)+6 (n^4))))+(e^3) ((f^3) (m^5) (-1+n)+(f^2) (m^4) (-2+8 n-4 (n^2)+f (4-7 n+4 (n^2)))+f n (1-6 n+6 (n^2)-f (2-8 n+(n^2)+4 (n^3))+(f^2) (1-2 n-4 (n^2)+6 (n^3)))+f (m^3) (1+2 n-4 (n^2)+(f^2) (-4+n+17 (n^2)-18 (n^3))+f (2-8 n-16 (n^2)+15 (n^3)))+m (-(((-1+n))^2) (-1+3 n)+(f^2) (5-11 n-19 (n^2)+16 (n^3)+4 (n^4))+f (-4+16 n-3 (n^2)-18 (n^3)+6 (n^4))-2 (f^3) (1-6 (n^2)+7 (n^4)))+(m^2) (2 (((-1+n))^2)+f (-3-7 n+13 (n^2))+(f^2) (-2+16 n+4 (n^2)+3 (n^3)-12 (n^4))+(f^3) (3-2 n-13 (n^2)+4 (n^3)+14 (n^4))))),((1-n+e (-m+n)+f (-1+e m (m-n)+m n)) (d (-1+e) f (-1+m) n (e (m-n)+n) (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))+b e m (f (-1+n) n (1-n+f (-1+(-1+2 m) n))+(e^3) (m-n) (-1+n+f (1+(m^2)+n-(n^2)-m (1+n))+(f^2) ((m^3)-n (1+n)+m n (3+2 n)-(m^2) (1+3 n)))+e (-(((-1+n))^2)+f (-1+n) (-2+m-2 n+3 (n^2))+(f^2) (-1-2 n+(n^2)+3 (n^3)+(m^2) n (-4+5 n)+m (1+3 n-6 (n^3))))+(e^2) (-(1+m-2 n) (-1+n)+f (-2+m+2 n-3 m n+4 (n^2)-3 (n^3)+(m^2) (-1+2 n))+(f^2) (1+n-2 (n^2)-3 (n^3)+(m^3) (-2+4 n)+(m^2) (3-10 (n^2))+m (-2-2 n+6 (n^2)+6 (n^3)))))))/((f^2) (-1+m) (-1+n) (n^2) (1-n+f (-1+m n))+(e^5) (((m-n))^2) ((f^3) (m^4)+f n (1-f+(f^2) n)+f (m^2) (1+(2-f+3 (f^2)) n+f (-2+3 f) (n^2))-f (m^3) (1-f n+(f^2) (1+3 n))+m (1-n+(f^2) (1+2 n)-(f^3) n (1+3 n)+f (-2-2 n+(n^2))))+e f (-1+n) n ((1+m (-2+n)) (-1+n)-2 f (-1+n) (1+2 n+(m^2) (1+n)-m (3+2 n))+(f^2) (-1-3 n+3 (m^3) n+(n^2)+m (((2+n))^2)-(m^2) (2+6 n+(n^2))))+(e^4) (m-n) ((f^2) (m^4) (2-n+f (-2+4 n))+f n (-2+4 n-f (-3+3 n+(n^2))+(f^2) (-1-n+4 (n^2)))+f (m^3) (2-4 n+(f^2) (2+3 n-13 (n^2))+f (-4-5 n+7 (n^2)))+m (-2+5 n-3 (n^2)+(f^3) (1+4 n-2 (n^2)-11 (n^3))+(f^2) (-5-3 n+9 (n^2)+(n^3))+2 f (3-3 n-5 (n^2)+2 (n^3)))+(m^2) (-1+n+f (-2+4 n+4 (n^2))+(f^2) (4+4 n-8 (n^3))+(f^3) (-1-6 n+8 (n^2)+11 (n^3))))+(e^2) (3 (f^3) (m^4) (-1+n) n+(f^2) (m^3) (-1+f-2 n+8 f n+9 (n^2)-9 f (n^2)-5 (n^3))-f n (2-6 n+4 (n^2)+2 (f^2) (((-1+n))^2) (1+2 n)+f (-4+6 n+5 (n^2)-6 (n^3)))-f (m^2) (2-6 n+4 (n^2)+f (-5+4 n+7 (n^2)+5 (n^3)-8 (n^4))+(f^2) (3+5 n-2 (n^2)-12 (n^3)+6 (n^4)))+m ((((-1+n))^3)-2 f (-2+3 n+4 (n^2)-7 (n^3)+2 (n^4))+(f^3) (2+6 n-8 (n^2)-6 (n^3)+6 (n^4))-(f^2) (5+3 n-25 (n^2)+8 (n^3)+6 (n^4))))+(e^3) ((f^3) (m^5) (-1+n)+(f^2) (m^4) (-2+8 n-4 (n^2)+f (4-7 n+4 (n^2)))+f n (1-6 n+6 (n^2)-f (2-8 n+(n^2)+4 (n^3))+(f^2) (1-2 n-4 (n^2)+6 (n^3)))+f (m^3) (1+2 n-4 (n^2)+(f^2) (-4+n+17 (n^2)-18 (n^3))+f (2-8 n-16 (n^2)+15 (n^3)))+m (-(((-1+n))^2) (-1+3 n)+(f^2) (5-11 n-19 (n^2)+16 (n^3)+4 (n^4))+f (-4+16 n-3 (n^2)-18 (n^3)+6 (n^4))-2 (f^3) (1-6 (n^2)+7 (n^4)))+(m^2) (2 (((-1+n))^2)+f (-3-7 n+13 (n^2))+(f^2) (-2+16 n+4 (n^2)+3 (n^3)-12 (n^4))+(f^3) (3-2 n-13 (n^2)+4 (n^3)+14 (n^4)))))},{((1-n+e (-m+n)+f (-1+e m (m-n)+m n)) (c (-1+e) f (-1+m) n (e (m-n)+n) (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))+a e m (f (-1+n) n (1-n+f (-1+(-1+2 m) n))+(e^3) (m-n) (-1+n+f (1+(m^2)+n-(n^2)-m (1+n))+(f^2) ((m^3)-n (1+n)+m n (3+2 n)-(m^2) (1+3 n)))+e (-(((-1+n))^2)+f (-1+n) (-2+m-2 n+3 (n^2))+(f^2) (-1-2 n+(n^2)+3 (n^3)+(m^2) n (-4+5 n)+m (1+3 n-6 (n^3))))+(e^2) (-(1+m-2 n) (-1+n)+f (-2+m+2 n-3 m n+4 (n^2)-3 (n^3)+(m^2) (-1+2 n))+(f^2) (1+n-2 (n^2)-3 (n^3)+(m^3) (-2+4 n)+(m^2) (3-10 (n^2))+m (-2-2 n+6 (n^2)+6 (n^3)))))))/((f^2) (-1+m) (-1+n) (n^3) (1-n+f (-1+m n))-e f (-1+n) n ((-1+n) (1+(-2+m) n)-f (-1+n) (2+(-2+3 m-3 (m^2)) n+5 (-1+m) (n^2))+(f^2) (-1+(1-2 m+3 (m^2)) n+(5-8 m+7 (m^2)-5 (m^3)) (n^2)+5 (-1+m) m (n^3)))+(e^5) (((m-n))^2) (1-n+f (-1+n) (1+(m^2)+2 n-m n)-(f^2) ((m^3)+m n (3+n-(n^2))+n (-2+(n^2))+(m^2) (-2-2 n+(n^2)))+(f^3) ((m^5)-(n^2)+m (n^2) (3+n)-(m^4) (1+3 n)+(m^3) n (4+3 n)-(m^2) n (2+4 n+(n^2))))+(e^4) (m-n) ((2+m-3 n) (-1+n)+f (4-3 n-(m^3) n-8 (n^2)+8 (n^3)+(m^2) (3-5 n+5 (n^2))+m (-1+n+(n^2)-4 (n^3)))+(f^3) ((m^5) (-2+5 n)+n (2+n-5 (n^2))-(m^4) (-3+n+15 (n^2))+m n (-5-2 n+12 (n^2)+5 (n^3))+(m^3) (-3-5 n+16 (n^2)+15 (n^3))+(m^2) (2+8 n-8 (n^2)-18 (n^3)-5 (n^4)))+(f^2) (-2+(m^4)-4 n+10 (n^2)+2 (n^3)-5 (n^4)+(m^3) (1-7 n+2 (n^2))+(m^2) (-5+6 n+12 (n^2)-7 (n^3))+m (2+3 n-11 (n^2)-3 (n^3)+5 (n^4))))+(e^2) ((((-1+n))^3)+f (-1+n) (-3+n+8 (n^2)-8 (n^3)+(m^2) (n-3 (n^2))+m (1-2 n+(n^2)+4 (n^3)))-(f^2) (3+n-16 (n^2)+11 (n^3)+12 (n^4)-10 (n^5)+(m^3) n (3-7 n+3 (n^2))-(m^2) n (1+5 n-21 (n^2)+12 (n^3))+m (-2+2 n+7 (n^2)-12 (n^3)-8 (n^4)+10 (n^5)))+(f^3) (1+2 n-6 (n^2)-6 (n^3)+10 (n^4)+(m^4) (n^2) (-9+10 n)+(m^3) n (3+11 n+2 (n^2)-20 (n^3))+2 (m^2) (n^2) (-9-2 n+9 (n^2)+5 (n^3))-m (1+n-10 (n^2)-10 (n^3)+12 (n^4)+10 (n^5))))+(e^3) ((1+2 m-3 n) (((-1+n))^2)-f (3-9 n-(n^2)+18 (n^3)-12 (n^4)+(m^3) n (-2+3 n)+(m^2) (1-4 n+9 (n^2)-9 (n^3))+m (2+3 n-11 (n^2)+3 (n^3)+6 (n^4)))-(f^2) (-3+3 n+14 (n^2)-17 (n^3)-8 (n^4)+10 (n^5)+(m^4) (1-4 n+(n^2))+(m^3) (1-5 n+20 (n^2)-9 (n^3))+(m^2) (-4+11 n-7 (n^2)-27 (n^3)+18 (n^4))-m (-2+8 n+(n^2)-20 (n^3)-2 (n^4)+10 (n^5)))+(f^3) (-1-n+6 (n^2)+4 (n^3)-10 (n^4)+(m^5) n (-7+10 n)+(m^4) (1+10 n+5 (n^2)-30 (n^3))+(m^3) (1-14 n-15 (n^2)+24 (n^3)+30 (n^4))+m (2-n-14 (n^2)-4 (n^3)+18 (n^4)+10 (n^5))-(m^2) (3-7 n-26 (n^2)+12 (n^3)+32 (n^4)+10 (n^5))))),((1-n+e (-m+n)+f (-1+e m (m-n)+m n)) (d (-1+e) f (-1+m) n (e (m-n)+n) (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))+b e m (f (-1+n) n (1-n+f (-1+(-1+2 m) n))+(e^3) (m-n) (-1+n+f (1+(m^2)+n-(n^2)-m (1+n))+(f^2) ((m^3)-n (1+n)+m n (3+2 n)-(m^2) (1+3 n)))+e (-(((-1+n))^2)+f (-1+n) (-2+m-2 n+3 (n^2))+(f^2) (-1-2 n+(n^2)+3 (n^3)+(m^2) n (-4+5 n)+m (1+3 n-6 (n^3))))+(e^2) (-(1+m-2 n) (-1+n)+f (-2+m+2 n-3 m n+4 (n^2)-3 (n^3)+(m^2) (-1+2 n))+(f^2) (1+n-2 (n^2)-3 (n^3)+(m^3) (-2+4 n)+(m^2) (3-10 (n^2))+m (-2-2 n+6 (n^2)+6 (n^3)))))))/((f^2) (-1+m) (-1+n) (n^3) (1-n+f (-1+m n))-e f (-1+n) n ((-1+n) (1+(-2+m) n)-f (-1+n) (2+(-2+3 m-3 (m^2)) n+5 (-1+m) (n^2))+(f^2) (-1+(1-2 m+3 (m^2)) n+(5-8 m+7 (m^2)-5 (m^3)) (n^2)+5 (-1+m) m (n^3)))+(e^5) (((m-n))^2) (1-n+f (-1+n) (1+(m^2)+2 n-m n)-(f^2) ((m^3)+m n (3+n-(n^2))+n (-2+(n^2))+(m^2) (-2-2 n+(n^2)))+(f^3) ((m^5)-(n^2)+m (n^2) (3+n)-(m^4) (1+3 n)+(m^3) n (4+3 n)-(m^2) n (2+4 n+(n^2))))+(e^4) (m-n) ((2+m-3 n) (-1+n)+f (4-3 n-(m^3) n-8 (n^2)+8 (n^3)+(m^2) (3-5 n+5 (n^2))+m (-1+n+(n^2)-4 (n^3)))+(f^3) ((m^5) (-2+5 n)+n (2+n-5 (n^2))-(m^4) (-3+n+15 (n^2))+m n (-5-2 n+12 (n^2)+5 (n^3))+(m^3) (-3-5 n+16 (n^2)+15 (n^3))+(m^2) (2+8 n-8 (n^2)-18 (n^3)-5 (n^4)))+(f^2) (-2+(m^4)-4 n+10 (n^2)+2 (n^3)-5 (n^4)+(m^3) (1-7 n+2 (n^2))+(m^2) (-5+6 n+12 (n^2)-7 (n^3))+m (2+3 n-11 (n^2)-3 (n^3)+5 (n^4))))+(e^2) ((((-1+n))^3)+f (-1+n) (-3+n+8 (n^2)-8 (n^3)+(m^2) (n-3 (n^2))+m (1-2 n+(n^2)+4 (n^3)))-(f^2) (3+n-16 (n^2)+11 (n^3)+12 (n^4)-10 (n^5)+(m^3) n (3-7 n+3 (n^2))-(m^2) n (1+5 n-21 (n^2)+12 (n^3))+m (-2+2 n+7 (n^2)-12 (n^3)-8 (n^4)+10 (n^5)))+(f^3) (1+2 n-6 (n^2)-6 (n^3)+10 (n^4)+(m^4) (n^2) (-9+10 n)+(m^3) n (3+11 n+2 (n^2)-20 (n^3))+2 (m^2) (n^2) (-9-2 n+9 (n^2)+5 (n^3))-m (1+n-10 (n^2)-10 (n^3)+12 (n^4)+10 (n^5))))+(e^3) ((1+2 m-3 n) (((-1+n))^2)-f (3-9 n-(n^2)+18 (n^3)-12 (n^4)+(m^3) n (-2+3 n)+(m^2) (1-4 n+9 (n^2)-9 (n^3))+m (2+3 n-11 (n^2)+3 (n^3)+6 (n^4)))-(f^2) (-3+3 n+14 (n^2)-17 (n^3)-8 (n^4)+10 (n^5)+(m^4) (1-4 n+(n^2))+(m^3) (1-5 n+20 (n^2)-9 (n^3))+(m^2) (-4+11 n-7 (n^2)-27 (n^3)+18 (n^4))-m (-2+8 n+(n^2)-20 (n^3)-2 (n^4)+10 (n^5)))+(f^3) (-1-n+6 (n^2)+4 (n^3)-10 (n^4)+(m^5) n (-7+10 n)+(m^4) (1+10 n+5 (n^2)-30 (n^3))+(m^3) (1-14 n-15 (n^2)+24 (n^3)+30 (n^4))+m (2-n-14 (n^2)-4 (n^3)+18 (n^4)+10 (n^5))-(m^2) (3-7 n-26 (n^2)+12 (n^3)+32 (n^4)+10 (n^5)))))}}};

zerotripskew[{a_,b_,c_,d_,e_,f_,m_,n_},k_]:=Module[{start,positions},
start=Take[{{{a,b}(*1*),{m a,m b}(*-1*)},{ {c,d}(*2*), {n c,n d}(*-2*)}, 
{e{m a,m b} +(1-e){n c,n d}(*3*),{((a e m+c n-c e n)/(e m+n-e n)),((b e m+d n-d e n)/(e m+n-e n))}(*-3*)},
{{a f m-(((-1+f) (a e m-c (-1+e) n))/(e (m-n)+n)),b f m-(((-1+f) (b e m-d (-1+e) n))/(e (m-n)+n))}(*4*),{((c (-1+e) (-1+f) n+a m (e+e f (-1+m-n)+f n))/(1+f (-1+e m (m-n)+m n))),((d (-1+e) (-1+f) n+b m (e+e f (-1+m-n)+f n))/(1+f (-1+e m (m-n)+m n)))}(*-4*)},
{{(c (-1+e) (-1+f) n (-1+e (m-n)+n)+a e f (-1+m) m (e (m-n)+n))/(-1+f+e (1+m-e m+f (-1+(m^2) (-1+e m)))+n+(-f m+e (-2+e+e f m-2 (-1+e) f (m^2))) n+(((-1+e))^2) f (-1+m) (n^2)),(d (-1+e) (-1+f) n (-1+e (m-n)+n)+b e f (-1+m) m (e (m-n)+n))/(-1+f+e (1+m-e m+f (-1+(m^2) (-1+e m)))+n+(-f m+e (-2+e+e f m-2 (-1+e) f (m^2))) n+(((-1+e))^2) f (-1+m) (n^2))}(*5*),{(c (-1+e) (-1+f) n (-1+e (m-n)+n)+a e f (-1+m) m (e (m-n)+n))/(e f (-1+m) m+(-1+e) (-1+e m) (-1+f m) n-(((-1+e))^2) (-1+f m) (n^2)),(d (-1+e) (-1+f) n (-1+e (m-n)+n)+b e f (-1+m) m (e (m-n)+n))/(e f (-1+m) m+(-1+e) (-1+e m) (-1+f m) n-(((-1+e))^2) (-1+f m) (n^2))}(*-5*)},
{{(c (-1+f) f (-1+m) n (-1+e (m-n)+n) (e (m-n)+n)+a m (-1+n) (e+e f (-1+m-n)+f n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n))))/(f (-1+n) n (1-f+m (-1+f m) n)+e ((-1+f) (1+f (-1+m))+(2+f (-2+m (1+m+f (-1+m-2 (m^2))))) n+(-1+f (-1-2 (m^2)+2 f (1+m (-1+m+(m^2))))) (n^2)-2 f m (-1+f m) (n^3))+(e^2) (m-n) (1-n+f (-1+m n (1-m+n)+f (n+m (-2 n+m (1+m (-1+n)+n-(n^2))))))),(d (-1+f) f (-1+m) n (-1+e (m-n)+n) (e (m-n)+n)+b m (-1+n) (e+e f (-1+m-n)+f n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n))))/(f (-1+n) n (1-f+m (-1+f m) n)+e ((-1+f) (1+f (-1+m))+(2+f (-2+m (1+m+f (-1+m-2 (m^2))))) n+(-1+f (-1-2 (m^2)+2 f (1+m (-1+m+(m^2))))) (n^2)-2 f m (-1+f m) (n^3))+(e^2) (m-n) (1-n+f (-1+m n (1-m+n)+f (n+m (-2 n+m (1+m (-1+n)+n-(n^2)))))))}(*6*),{(c (-1+f) f (-1+m) n (-1+e (m-n)+n) (e (m-n)+n)+a m (-1+n) (e+e f (-1+m-n)+f n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n))))/(e ((-1+f) m+(2 m-f (-1+f+m+f m (-1+2 m))) n+(-m+f (-2+m (f-m+3 f m))) (n^2)+2 f (f+m-2 f m) (n^3))+(e^2) (m-n) (-1+f n) (f (m^2)+f n+m (-1+n-2 f n))+f (-1+n) n (1-m n+f (-1-n+2 m n))),(d (-1+f) f (-1+m) n (-1+e (m-n)+n) (e (m-n)+n)+b m (-1+n) (e+e f (-1+m-n)+f n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n))))/(e ((-1+f) m+(2 m-f (-1+f+m+f m (-1+2 m))) n+(-m+f (-2+m (f-m+3 f m))) (n^2)+2 f (f+m-2 f m) (n^3))+(e^2) (m-n) (-1+f n) (f (m^2)+f n+m (-1+n-2 f n))+f (-1+n) n (1-m n+f (-1-n+2 m n)))}(*-6*)},
{{(f (e (m-n)+n) (a e (-1+m) m (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))-c (-1+e) n (-1+e (m-n)+n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n)))))/((e^3) (m-n) (2+m+f (-3+f-m+(-2+f) (m^2)+f (m^3))-5 n+(-m+f ((((2+m))^2)-f (-1+m+3 (m^2)))) n+(3-f (-2+m+2 f (2+(-1+m) m))) (n^2)+4 f (-1+f m) (n^3))+f (-1+n) (n^2) (1-n+f (-1+m n))-(e^4) (((m-n))^2) (1-n+f (-1+n) (1+m+n)+(f^2) ((m^2)+n-m n (1+n)))-e ((((-1+n))^3)+f (2-(4+m) n+(6+m) (n^3)-4 (n^4))+(f^2) (-1+n (1+m+(3+(-1+m) m) n-2 (2+m+(m^2)) (n^2)+4 m (n^3))))+(e^2) (-(1+2 m-3 n) (((-1+n))^2)+f (2+2 m (1+m)-7 n-4 m (1+m) n+(4+m+(m^2)) (n^2)+3 (2+m) (n^3)-6 (n^4))+(f^2) (-1+2 n+3 (1-2 n) (n^2)+6 m (n^4)+(m^3) n (1+n)-(m^2) (2+n (-3+n+6 (n^2)))))),(f (e (m-n)+n) (-d (-1+e) n (1-e m+(-1+e) n) (-1+f+e m-e f (m^2)+(-1+e) (-1+f m) n)+b e (-1+m) m (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))))/((e^3) (m-n) (2+m+f (-3+f-m+(-2+f) (m^2)+f (m^3))-5 n+(-m+f ((((2+m))^2)-f (-1+m+3 (m^2)))) n+(3-f (-2+m+2 f (2+(-1+m) m))) (n^2)+4 f (-1+f m) (n^3))+f (-1+n) (n^2) (1-n+f (-1+m n))-(e^4) (((m-n))^2) (1-n+f (-1+n) (1+m+n)+(f^2) ((m^2)+n-m n (1+n)))-e ((((-1+n))^3)+f (2-(4+m) n+(6+m) (n^3)-4 (n^4))+(f^2) (-1+n (1+m+(3+(-1+m) m) n-2 (2+m+(m^2)) (n^2)+4 m (n^3))))+(e^2) (-(1+2 m-3 n) (((-1+n))^2)+f (2+2 m (1+m)-7 n-4 m (1+m) n+(4+m+(m^2)) (n^2)+3 (2+m) (n^3)-6 (n^4))+(f^2) (-1+2 n+3 (1-2 n) (n^2)+6 m (n^4)+(m^3) n (1+n)-(m^2) (2+n (-3+n+6 (n^2))))))}(*7*),{-((f (e (m-n)+n) (a e (-1+m) m (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))-c (-1+e) n (-1+e (m-n)+n) (1-e m+(-1+e) n+f (-1+m (e m+n-e n)))))/(-(e^3) (m-n) (-2-m+f (2+m (-1+(2+f (-1+m)) m))+5 n+(m-f (f+m+2 f (-1+m) m+4 (m^2))) n+(-3-4 f+f (6+f) m) (n^2))+(e^2) (-1-2 m+f (2+m+f (-1+m) (1+(m^2)))+5 n+(4 m-f (5+m (-3+f+4 m+f m (-1+3 m)))) n+(-7-2 m+f (-2+3 f-3 f m+(5+6 f) (m^2))) (n^2)-3 (-1-2 f+f (2+f) m) (n^3))+(e^4) (((m-n))^2) (-1+n+f ((m^2)+n-2 m n))-f (-1+n) n (1-n+f (-1+m n))+e (-(((-1+n))^3)+f (-1+n) (2-m+m n+2 (-2+m) (n^2))+(f^2) (1-m+n+2 (m^2) n-3 (1+(m^2)) (n^2)+3 m (n^3))))),-((f (e (m-n)+n) (-d (-1+e) n (1-e m+(-1+e) n) (-1+f+e m-e f (m^2)+(-1+e) (-1+f m) n)+b e (-1+m) m (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))))/(-(e^3) (m-n) (-2-m+f (2+m (-1+(2+f (-1+m)) m))+5 n+(m-f (f+m+2 f (-1+m) m+4 (m^2))) n+(-3-4 f+f (6+f) m) (n^2))+(e^2) (-1-2 m+f (2+m+f (-1+m) (1+(m^2)))+5 n+(4 m-f (5+m (-3+f+4 m+f m (-1+3 m)))) n+(-7-2 m+f (-2+3 f-3 f m+(5+6 f) (m^2))) (n^2)-3 (-1-2 f+f (2+f) m) (n^3))+(e^4) (((m-n))^2) (-1+n+f ((m^2)+n-2 m n))-f (-1+n) n (1-n+f (-1+m n))+e (-(((-1+n))^3)+f (-1+n) (2-m+m n+2 (-2+m) (n^2))+(f^2) (1-m+n+2 (m^2) n-3 (1+(m^2)) (n^2)+3 m (n^3)))))}(*-7*)},
{{((1-n+e (-m+n)+f (-1+e m (m-n)+m n)) (c (-1+e) f (-1+m) n (e (m-n)+n) (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))+a e m (f (-1+n) n (1-n+f (-1+(-1+2 m) n))+(e^3) (m-n) (-1+n+f (1+(m^2)+n-(n^2)-m (1+n))+(f^2) ((m^3)-n (1+n)+m n (3+2 n)-(m^2) (1+3 n)))+e (-(((-1+n))^2)+f (-1+n) (-2+m-2 n+3 (n^2))+(f^2) (-1-2 n+(n^2)+3 (n^3)+(m^2) n (-4+5 n)+m (1+3 n-6 (n^3))))+(e^2) (-(1+m-2 n) (-1+n)+f (-2+m+2 n-3 m n+4 (n^2)-3 (n^3)+(m^2) (-1+2 n))+(f^2) (1+n-2 (n^2)-3 (n^3)+(m^3) (-2+4 n)+(m^2) (3-10 (n^2))+m (-2-2 n+6 (n^2)+6 (n^3)))))))/((f^2) (-1+m) (-1+n) (n^2) (1-n+f (-1+m n))+(e^5) (((m-n))^2) ((f^3) (m^4)+f n (1-f+(f^2) n)+f (m^2) (1+(2-f+3 (f^2)) n+f (-2+3 f) (n^2))-f (m^3) (1-f n+(f^2) (1+3 n))+m (1-n+(f^2) (1+2 n)-(f^3) n (1+3 n)+f (-2-2 n+(n^2))))+e f (-1+n) n ((1+m (-2+n)) (-1+n)-2 f (-1+n) (1+2 n+(m^2) (1+n)-m (3+2 n))+(f^2) (-1-3 n+3 (m^3) n+(n^2)+m (((2+n))^2)-(m^2) (2+6 n+(n^2))))+(e^4) (m-n) ((f^2) (m^4) (2-n+f (-2+4 n))+f n (-2+4 n-f (-3+3 n+(n^2))+(f^2) (-1-n+4 (n^2)))+f (m^3) (2-4 n+(f^2) (2+3 n-13 (n^2))+f (-4-5 n+7 (n^2)))+m (-2+5 n-3 (n^2)+(f^3) (1+4 n-2 (n^2)-11 (n^3))+(f^2) (-5-3 n+9 (n^2)+(n^3))+2 f (3-3 n-5 (n^2)+2 (n^3)))+(m^2) (-1+n+f (-2+4 n+4 (n^2))+(f^2) (4+4 n-8 (n^3))+(f^3) (-1-6 n+8 (n^2)+11 (n^3))))+(e^2) (3 (f^3) (m^4) (-1+n) n+(f^2) (m^3) (-1+f-2 n+8 f n+9 (n^2)-9 f (n^2)-5 (n^3))-f n (2-6 n+4 (n^2)+2 (f^2) (((-1+n))^2) (1+2 n)+f (-4+6 n+5 (n^2)-6 (n^3)))-f (m^2) (2-6 n+4 (n^2)+f (-5+4 n+7 (n^2)+5 (n^3)-8 (n^4))+(f^2) (3+5 n-2 (n^2)-12 (n^3)+6 (n^4)))+m ((((-1+n))^3)-2 f (-2+3 n+4 (n^2)-7 (n^3)+2 (n^4))+(f^3) (2+6 n-8 (n^2)-6 (n^3)+6 (n^4))-(f^2) (5+3 n-25 (n^2)+8 (n^3)+6 (n^4))))+(e^3) ((f^3) (m^5) (-1+n)+(f^2) (m^4) (-2+8 n-4 (n^2)+f (4-7 n+4 (n^2)))+f n (1-6 n+6 (n^2)-f (2-8 n+(n^2)+4 (n^3))+(f^2) (1-2 n-4 (n^2)+6 (n^3)))+f (m^3) (1+2 n-4 (n^2)+(f^2) (-4+n+17 (n^2)-18 (n^3))+f (2-8 n-16 (n^2)+15 (n^3)))+m (-(((-1+n))^2) (-1+3 n)+(f^2) (5-11 n-19 (n^2)+16 (n^3)+4 (n^4))+f (-4+16 n-3 (n^2)-18 (n^3)+6 (n^4))-2 (f^3) (1-6 (n^2)+7 (n^4)))+(m^2) (2 (((-1+n))^2)+f (-3-7 n+13 (n^2))+(f^2) (-2+16 n+4 (n^2)+3 (n^3)-12 (n^4))+(f^3) (3-2 n-13 (n^2)+4 (n^3)+14 (n^4))))),((1-n+e (-m+n)+f (-1+e m (m-n)+m n)) (d (-1+e) f (-1+m) n (e (m-n)+n) (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))+b e m (f (-1+n) n (1-n+f (-1+(-1+2 m) n))+(e^3) (m-n) (-1+n+f (1+(m^2)+n-(n^2)-m (1+n))+(f^2) ((m^3)-n (1+n)+m n (3+2 n)-(m^2) (1+3 n)))+e (-(((-1+n))^2)+f (-1+n) (-2+m-2 n+3 (n^2))+(f^2) (-1-2 n+(n^2)+3 (n^3)+(m^2) n (-4+5 n)+m (1+3 n-6 (n^3))))+(e^2) (-(1+m-2 n) (-1+n)+f (-2+m+2 n-3 m n+4 (n^2)-3 (n^3)+(m^2) (-1+2 n))+(f^2) (1+n-2 (n^2)-3 (n^3)+(m^3) (-2+4 n)+(m^2) (3-10 (n^2))+m (-2-2 n+6 (n^2)+6 (n^3)))))))/((f^2) (-1+m) (-1+n) (n^2) (1-n+f (-1+m n))+(e^5) (((m-n))^2) ((f^3) (m^4)+f n (1-f+(f^2) n)+f (m^2) (1+(2-f+3 (f^2)) n+f (-2+3 f) (n^2))-f (m^3) (1-f n+(f^2) (1+3 n))+m (1-n+(f^2) (1+2 n)-(f^3) n (1+3 n)+f (-2-2 n+(n^2))))+e f (-1+n) n ((1+m (-2+n)) (-1+n)-2 f (-1+n) (1+2 n+(m^2) (1+n)-m (3+2 n))+(f^2) (-1-3 n+3 (m^3) n+(n^2)+m (((2+n))^2)-(m^2) (2+6 n+(n^2))))+(e^4) (m-n) ((f^2) (m^4) (2-n+f (-2+4 n))+f n (-2+4 n-f (-3+3 n+(n^2))+(f^2) (-1-n+4 (n^2)))+f (m^3) (2-4 n+(f^2) (2+3 n-13 (n^2))+f (-4-5 n+7 (n^2)))+m (-2+5 n-3 (n^2)+(f^3) (1+4 n-2 (n^2)-11 (n^3))+(f^2) (-5-3 n+9 (n^2)+(n^3))+2 f (3-3 n-5 (n^2)+2 (n^3)))+(m^2) (-1+n+f (-2+4 n+4 (n^2))+(f^2) (4+4 n-8 (n^3))+(f^3) (-1-6 n+8 (n^2)+11 (n^3))))+(e^2) (3 (f^3) (m^4) (-1+n) n+(f^2) (m^3) (-1+f-2 n+8 f n+9 (n^2)-9 f (n^2)-5 (n^3))-f n (2-6 n+4 (n^2)+2 (f^2) (((-1+n))^2) (1+2 n)+f (-4+6 n+5 (n^2)-6 (n^3)))-f (m^2) (2-6 n+4 (n^2)+f (-5+4 n+7 (n^2)+5 (n^3)-8 (n^4))+(f^2) (3+5 n-2 (n^2)-12 (n^3)+6 (n^4)))+m ((((-1+n))^3)-2 f (-2+3 n+4 (n^2)-7 (n^3)+2 (n^4))+(f^3) (2+6 n-8 (n^2)-6 (n^3)+6 (n^4))-(f^2) (5+3 n-25 (n^2)+8 (n^3)+6 (n^4))))+(e^3) ((f^3) (m^5) (-1+n)+(f^2) (m^4) (-2+8 n-4 (n^2)+f (4-7 n+4 (n^2)))+f n (1-6 n+6 (n^2)-f (2-8 n+(n^2)+4 (n^3))+(f^2) (1-2 n-4 (n^2)+6 (n^3)))+f (m^3) (1+2 n-4 (n^2)+(f^2) (-4+n+17 (n^2)-18 (n^3))+f (2-8 n-16 (n^2)+15 (n^3)))+m (-(((-1+n))^2) (-1+3 n)+(f^2) (5-11 n-19 (n^2)+16 (n^3)+4 (n^4))+f (-4+16 n-3 (n^2)-18 (n^3)+6 (n^4))-2 (f^3) (1-6 (n^2)+7 (n^4)))+(m^2) (2 (((-1+n))^2)+f (-3-7 n+13 (n^2))+(f^2) (-2+16 n+4 (n^2)+3 (n^3)-12 (n^4))+(f^3) (3-2 n-13 (n^2)+4 (n^3)+14 (n^4)))))},{((1-n+e (-m+n)+f (-1+e m (m-n)+m n)) (c (-1+e) f (-1+m) n (e (m-n)+n) (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))+a e m (f (-1+n) n (1-n+f (-1+(-1+2 m) n))+(e^3) (m-n) (-1+n+f (1+(m^2)+n-(n^2)-m (1+n))+(f^2) ((m^3)-n (1+n)+m n (3+2 n)-(m^2) (1+3 n)))+e (-(((-1+n))^2)+f (-1+n) (-2+m-2 n+3 (n^2))+(f^2) (-1-2 n+(n^2)+3 (n^3)+(m^2) n (-4+5 n)+m (1+3 n-6 (n^3))))+(e^2) (-(1+m-2 n) (-1+n)+f (-2+m+2 n-3 m n+4 (n^2)-3 (n^3)+(m^2) (-1+2 n))+(f^2) (1+n-2 (n^2)-3 (n^3)+(m^3) (-2+4 n)+(m^2) (3-10 (n^2))+m (-2-2 n+6 (n^2)+6 (n^3)))))))/((f^2) (-1+m) (-1+n) (n^3) (1-n+f (-1+m n))-e f (-1+n) n ((-1+n) (1+(-2+m) n)-f (-1+n) (2+(-2+3 m-3 (m^2)) n+5 (-1+m) (n^2))+(f^2) (-1+(1-2 m+3 (m^2)) n+(5-8 m+7 (m^2)-5 (m^3)) (n^2)+5 (-1+m) m (n^3)))+(e^5) (((m-n))^2) (1-n+f (-1+n) (1+(m^2)+2 n-m n)-(f^2) ((m^3)+m n (3+n-(n^2))+n (-2+(n^2))+(m^2) (-2-2 n+(n^2)))+(f^3) ((m^5)-(n^2)+m (n^2) (3+n)-(m^4) (1+3 n)+(m^3) n (4+3 n)-(m^2) n (2+4 n+(n^2))))+(e^4) (m-n) ((2+m-3 n) (-1+n)+f (4-3 n-(m^3) n-8 (n^2)+8 (n^3)+(m^2) (3-5 n+5 (n^2))+m (-1+n+(n^2)-4 (n^3)))+(f^3) ((m^5) (-2+5 n)+n (2+n-5 (n^2))-(m^4) (-3+n+15 (n^2))+m n (-5-2 n+12 (n^2)+5 (n^3))+(m^3) (-3-5 n+16 (n^2)+15 (n^3))+(m^2) (2+8 n-8 (n^2)-18 (n^3)-5 (n^4)))+(f^2) (-2+(m^4)-4 n+10 (n^2)+2 (n^3)-5 (n^4)+(m^3) (1-7 n+2 (n^2))+(m^2) (-5+6 n+12 (n^2)-7 (n^3))+m (2+3 n-11 (n^2)-3 (n^3)+5 (n^4))))+(e^2) ((((-1+n))^3)+f (-1+n) (-3+n+8 (n^2)-8 (n^3)+(m^2) (n-3 (n^2))+m (1-2 n+(n^2)+4 (n^3)))-(f^2) (3+n-16 (n^2)+11 (n^3)+12 (n^4)-10 (n^5)+(m^3) n (3-7 n+3 (n^2))-(m^2) n (1+5 n-21 (n^2)+12 (n^3))+m (-2+2 n+7 (n^2)-12 (n^3)-8 (n^4)+10 (n^5)))+(f^3) (1+2 n-6 (n^2)-6 (n^3)+10 (n^4)+(m^4) (n^2) (-9+10 n)+(m^3) n (3+11 n+2 (n^2)-20 (n^3))+2 (m^2) (n^2) (-9-2 n+9 (n^2)+5 (n^3))-m (1+n-10 (n^2)-10 (n^3)+12 (n^4)+10 (n^5))))+(e^3) ((1+2 m-3 n) (((-1+n))^2)-f (3-9 n-(n^2)+18 (n^3)-12 (n^4)+(m^3) n (-2+3 n)+(m^2) (1-4 n+9 (n^2)-9 (n^3))+m (2+3 n-11 (n^2)+3 (n^3)+6 (n^4)))-(f^2) (-3+3 n+14 (n^2)-17 (n^3)-8 (n^4)+10 (n^5)+(m^4) (1-4 n+(n^2))+(m^3) (1-5 n+20 (n^2)-9 (n^3))+(m^2) (-4+11 n-7 (n^2)-27 (n^3)+18 (n^4))-m (-2+8 n+(n^2)-20 (n^3)-2 (n^4)+10 (n^5)))+(f^3) (-1-n+6 (n^2)+4 (n^3)-10 (n^4)+(m^5) n (-7+10 n)+(m^4) (1+10 n+5 (n^2)-30 (n^3))+(m^3) (1-14 n-15 (n^2)+24 (n^3)+30 (n^4))+m (2-n-14 (n^2)-4 (n^3)+18 (n^4)+10 (n^5))-(m^2) (3-7 n-26 (n^2)+12 (n^3)+32 (n^4)+10 (n^5))))),((1-n+e (-m+n)+f (-1+e m (m-n)+m n)) (d (-1+e) f (-1+m) n (e (m-n)+n) (-f (-1+n) n+(e^2) (m-n) (-1+f n)+e (-1+n) (-1+f-f m+2 f n))+b e m (f (-1+n) n (1-n+f (-1+(-1+2 m) n))+(e^3) (m-n) (-1+n+f (1+(m^2)+n-(n^2)-m (1+n))+(f^2) ((m^3)-n (1+n)+m n (3+2 n)-(m^2) (1+3 n)))+e (-(((-1+n))^2)+f (-1+n) (-2+m-2 n+3 (n^2))+(f^2) (-1-2 n+(n^2)+3 (n^3)+(m^2) n (-4+5 n)+m (1+3 n-6 (n^3))))+(e^2) (-(1+m-2 n) (-1+n)+f (-2+m+2 n-3 m n+4 (n^2)-3 (n^3)+(m^2) (-1+2 n))+(f^2) (1+n-2 (n^2)-3 (n^3)+(m^3) (-2+4 n)+(m^2) (3-10 (n^2))+m (-2-2 n+6 (n^2)+6 (n^3)))))))/((f^2) (-1+m) (-1+n) (n^3) (1-n+f (-1+m n))-e f (-1+n) n ((-1+n) (1+(-2+m) n)-f (-1+n) (2+(-2+3 m-3 (m^2)) n+5 (-1+m) (n^2))+(f^2) (-1+(1-2 m+3 (m^2)) n+(5-8 m+7 (m^2)-5 (m^3)) (n^2)+5 (-1+m) m (n^3)))+(e^5) (((m-n))^2) (1-n+f (-1+n) (1+(m^2)+2 n-m n)-(f^2) ((m^3)+m n (3+n-(n^2))+n (-2+(n^2))+(m^2) (-2-2 n+(n^2)))+(f^3) ((m^5)-(n^2)+m (n^2) (3+n)-(m^4) (1+3 n)+(m^3) n (4+3 n)-(m^2) n (2+4 n+(n^2))))+(e^4) (m-n) ((2+m-3 n) (-1+n)+f (4-3 n-(m^3) n-8 (n^2)+8 (n^3)+(m^2) (3-5 n+5 (n^2))+m (-1+n+(n^2)-4 (n^3)))+(f^3) ((m^5) (-2+5 n)+n (2+n-5 (n^2))-(m^4) (-3+n+15 (n^2))+m n (-5-2 n+12 (n^2)+5 (n^3))+(m^3) (-3-5 n+16 (n^2)+15 (n^3))+(m^2) (2+8 n-8 (n^2)-18 (n^3)-5 (n^4)))+(f^2) (-2+(m^4)-4 n+10 (n^2)+2 (n^3)-5 (n^4)+(m^3) (1-7 n+2 (n^2))+(m^2) (-5+6 n+12 (n^2)-7 (n^3))+m (2+3 n-11 (n^2)-3 (n^3)+5 (n^4))))+(e^2) ((((-1+n))^3)+f (-1+n) (-3+n+8 (n^2)-8 (n^3)+(m^2) (n-3 (n^2))+m (1-2 n+(n^2)+4 (n^3)))-(f^2) (3+n-16 (n^2)+11 (n^3)+12 (n^4)-10 (n^5)+(m^3) n (3-7 n+3 (n^2))-(m^2) n (1+5 n-21 (n^2)+12 (n^3))+m (-2+2 n+7 (n^2)-12 (n^3)-8 (n^4)+10 (n^5)))+(f^3) (1+2 n-6 (n^2)-6 (n^3)+10 (n^4)+(m^4) (n^2) (-9+10 n)+(m^3) n (3+11 n+2 (n^2)-20 (n^3))+2 (m^2) (n^2) (-9-2 n+9 (n^2)+5 (n^3))-m (1+n-10 (n^2)-10 (n^3)+12 (n^4)+10 (n^5))))+(e^3) ((1+2 m-3 n) (((-1+n))^2)-f (3-9 n-(n^2)+18 (n^3)-12 (n^4)+(m^3) n (-2+3 n)+(m^2) (1-4 n+9 (n^2)-9 (n^3))+m (2+3 n-11 (n^2)+3 (n^3)+6 (n^4)))-(f^2) (-3+3 n+14 (n^2)-17 (n^3)-8 (n^4)+10 (n^5)+(m^4) (1-4 n+(n^2))+(m^3) (1-5 n+20 (n^2)-9 (n^3))+(m^2) (-4+11 n-7 (n^2)-27 (n^3)+18 (n^4))-m (-2+8 n+(n^2)-20 (n^3)-2 (n^4)+10 (n^5)))+(f^3) (-1-n+6 (n^2)+4 (n^3)-10 (n^4)+(m^5) n (-7+10 n)+(m^4) (1+10 n+5 (n^2)-30 (n^3))+(m^3) (1-14 n-15 (n^2)+24 (n^3)+30 (n^4))+m (2-n-14 (n^2)-4 (n^3)+18 (n^4)+10 (n^5))-(m^2) (3-7 n-26 (n^2)+12 (n^3)+32 (n^4)+10 (n^5)))))}}},k];
start
];