Pascal's Hexagons

This function will print out the nth Hexagon

n =5;

row1 = Array[1&, n];
hex = {row1};
rlength =n;
rowp = row1;
(*Print[row1]*)
For[j =1, j<n, j++,
nextrow = {1};
For[i =1, i <rlength , i ++,
temp = rowp[[i]] + rowp[[i+1]];
nextrow =Append[nextrow,temp]];
nextrow = Append[nextrow, 1];
rowp = nextrow;
hex = Append[hex, nextrow];
rlength = rlength + 1
(*Print[nextrow]*)];
For[j =1, j<n, j++,
nextrow = {rowp[[1]]+ rowp[[2]]};
For[i =2, i <rlength , i ++,
temp = rowp[[i]] + rowp[[i+1]];
nextrow =Append[nextrow,temp]];
rowp = nextrow;
hex = Append[hex, nextrow];
rlength = rlength - 1
(*Print[nextrow]*)];
Print[Column[hex, Center]]

This function prints out the largest number in each hexagon and then plots them.

(*don't change any of the code*)

largest = {1};
For[n =2, n<19, n++,
row1 = Array[1&, n];
hex = {row1};
rlength =n;
rowp = row1;
For[j =1, j<n, j++,
nextrow = {1};
For[i =1, i <rlength , i ++,
temp = rowp[[i]] + rowp[[i+1]];
nextrow =Append[nextrow,temp]];
nextrow = Append[nextrow, 1];
rowp = nextrow;
hex = Append[hex, nextrow];
rlength = rlength + 1];
For[j =1, j<n, j++,
nextrow = {rowp[[1]]+ rowp[[2]]};
For[i =2, i <rlength , i ++,
temp = rowp[[i]] + rowp[[i+1]];
nextrow =Append[nextrow,temp]];
rowp = nextrow;
hex = Append[hex, nextrow];
rlength = rlength - 1];
largest = Append[largest, hex[[2n-1]][[Floor[(n+1)/2]]]]]
largest
ListLinePlot[largest]

This function prints out the triangle from by the last row of each hexagon.

(*enter the number of rows*)
max = 10;

lastRow = {1};
For[n =2, n<max, n++,
row1 = Array[1&, n];
hex = {row1};
rlength =n;
rowp = row1;
For[j =1, j<n, j++,
nextrow = {1};
For[i =1, i <rlength , i ++,
temp = rowp[[i]] + rowp[[i+1]];
nextrow =Append[nextrow,temp]];
nextrow = Append[nextrow, 1];
rowp = nextrow;
hex = Append[hex, nextrow];
rlength = rlength + 1];
For[j =1, j<n, j++,
nextrow = {rowp[[1]]+ rowp[[2]]};
For[i =2, i <rlength , i ++,
temp = rowp[[i]] + rowp[[i+1]];
nextrow =Append[nextrow,temp]];
rowp = nextrow;
hex = Append[hex, nextrow];
rlength = rlength - 1];
lastRow = Append[lastRow, hex[[2n-1]]]]
(*For[ i = 1, i <max, i ++,
	Print[lastRow[[i]]];*)
Print[Column[lastRow, Center]];

This function prints out a nth hexagon that starts will an abitrary first row.

(*enter the side length and first row*)
n =3;
row1 = {10,-10, 1};

hex = {row1};
rlength =n;
rowp = row1;
Print[row1]
For[j =1, j<n, j++,
nextrow = {1};
For[i =1, i <rlength , i ++,
temp = rowp[[i]] + rowp[[i+1]];
nextrow =Append[nextrow,temp]];
nextrow = Append[nextrow, rowp[[rlength]]];
rowp = nextrow;
hex = Append[hex, nextrow];
rlength = rlength + 1;
Print[nextrow]];
For[j =1, j<n, j++,
nextrow = {rowp[[1]]+ rowp[[2]]};
For[i =2, i <rlength , i ++,
temp = rowp[[i]] + rowp[[i+1]];
nextrow =Append[nextrow,temp]];
rowp = nextrow;
hex = Append[hex, nextrow];
rlength = rlength - 1;
Print[nextrow]];

Graphs for the largest number

RegionPlot[{ Tooltip[3 +2x +3y  <5 && 5y<5,"1st is largest"], Tooltip[3 +2x +3y  >5 && 3 +2x +3y  >5y ,"2nd is largest"],  Tooltip[5y > 5 && 5y > 3+2x+3y ,"3rd is largest"]},{x,-10,10},{y,-10,10}, PlotLabel->"Set the first integer to 1",FrameLabel->{"2nd integer", "3rd integer"}]

RegionPlot[ {Tooltip[3x +2 +3y  <5x && 5y<5x,"1st is largest"], Tooltip[3x +2 +3y  >5x && 3x +2 +3y  >5y ,"2nd is largest"],Tooltip[ 5y > 5x && 5y > 3x+2+3y ,"3rd is largest"]},{x,-10,10},{y,-10,10}, PlotLabel->"Set the first integer to 2",FrameLabel->{"1st integer", "3rd integer"}]

RegionPlot[ {Tooltip[3x +2y +3  <5x && 5<5x,"1st is largest"], Tooltip[3x +2y +3  >5x && 3x +2y +3  >5 ,"2nd is largest"], Tooltip[5 > 5x && 5 > 3x+2y+3,"3rd is largest"] },{x,-10,10},{y,-10,10}, PlotLabel->"Set the first integer to 3",FrameLabel->{"1st integer", "2nd integer"}]

Show[RegionPlot3D[(2x>2y+3z)&&(6x+4y+z>x+4y+6z), {x,-10,10},{y,-10,10}, {z, -10, 10},AxesLabel->{"1st entry","2nd entry","3rd entry"},PlotRange->All,PlotStyle->Directive[Red,Opacity[0.5]]],
RegionPlot3D[(6x +4y +z < 4x + 6y + 4z) &&(4x + 6y + 4z> x + 4y +6z),{x,-10,10},{y,-10,10}, {z, -10, 10}, PlotStyle->Directive[Yellow,Opacity[.5]]],
RegionPlot3D[(x + 4y +6z> 4x + 6y + 4z) &&(6x +4y +z < x + 4y +6z) , {x,-10,10},{y,-10,10}, {z, -10, 10},PlotStyle->Directive[Blue,Opacity[0.5]]]]


(*Show[RegionPlot[ {3 +2x +3y  <5 && 5y<5, 3 +2x +3y  >5 && 3 +2x +3y  >5y , 5y > 5 && 5y > 3+2x+3y },{x,-10,10},{y,-10,10}], RegionPlot[ {3x +2 +3y  <5x && 5y<5x, 3x +2 +3y  >5x && 3x +2 +3y  >5y , 5y > 5x && 5y > 3x+2+3y },{x,-10,10},{y,-10,10}],
RegionPlot[ {3x +2y +3  <5x && 5<5x, 3x +2y +3  >5x && 3x +2y +3  >5 , 5 > 5x && 5 > 3x+2y+3 },{x,-10,10},{y,-10,10}]]*)