Build the following symmetric array

If we determine the elements in the first row, the remaining rows are obtained by simple rotation + padding and adding 1 to the previous rotated/padded row:

ClearAll[firstRow, rotatePad, spiralMat]

firstRow = Module[{rng = Range[0, Floor[(# - 1)/2]]}, 
    1 + Join[# If[OddQ @ #, Most @ rng, rng] , (# - 1) Reverse @ Rest @ rng]] &;

rotatePad = Fold[PadLeft, RotateRight[#, #2], Length[#] + {-#2, 1}] &;

spiralMat = MapIndexed[rotatePad[#, #2[[1]] - 1]&] @ NestList[#+1&, firstRow @ #, #-1]&;

Examples:

Row[MatrixForm[spiralMat[#]] & /@ Range[5, 9], Spacer[5]]

enter image description here

MatrixForm[spiralMat[9] /. x_Integer?Positive :> f[x]]

enter image description here

MatrixForm[# + Transpose @ # & @ spiralMat[9] /.  x_Integer?Positive :> f[x]]

enter image description here


Here is my modest attempt:

qdMat[n_Integer?Positive] := Module[{id, mm},
  id = Riffle @@ Reverse[MapAt[Reverse, TakeDrop[Range[n - 1], Quotient[n - 1, 2]], -1]];
  mm = TakeList[Array[f, Binomial[n, 2]], id][[InversePermutation[id]]];
  mm = PadRight[PadLeft[Reverse[Flatten[mm, {{2}, {1}}], 2], {Automatic, n}], {n, n}];
  mm + Transpose[mm]]

For instance,

qdMat[6]
   {{0, f[1], f[7], f[13], f[11], f[6]},
    {f[1], 0, f[2], f[8], f[14], f[12]},
    {f[7], f[2], 0, f[3], f[9], f[15]},
    {f[13], f[8], f[3], 0, f[4], f[10]},
    {f[11], f[14], f[9], f[4], 0, f[5]},
    {f[6], f[12], f[15], f[10], f[5], 0}}

qdMat[9]
   {{0, f[1], f[10], f[19], f[28], f[33], f[25], f[17], f[9]},
    {f[1], 0, f[2], f[11], f[20], f[29], f[34], f[26], f[18]},
    {f[10], f[2], 0, f[3], f[12], f[21], f[30], f[35], f[27]},
    {f[19], f[11], f[3], 0, f[4], f[13], f[22], f[31], f[36]},
    {f[28], f[20], f[12], f[4], 0, f[5], f[14], f[23], f[32]},
    {f[33], f[29], f[21], f[13], f[5], 0, f[6], f[15], f[24]},
    {f[25], f[34], f[30], f[22], f[14], f[6], 0, f[7], f[16]},
    {f[17], f[26], f[35], f[31], f[23], f[15], f[7], 0, f[8]},
    {f[9], f[18], f[27], f[36], f[32], f[24], f[16], f[8], 0}}

Because the diagonals switch from the corner to close to the diagonal there is no pretty solution (or at least no easy one). The following code will do the trick. You will have to do the lower triangle by yourself though.

n=9; 
m = ConstantArray[0, {n, n}];
initialxLeft = 2;
initialxRight = n;
leftOrRightToggle = "Left";
counter = 1;
While[initialxLeft <= initialxRight,
  If[leftOrRightToggle == "Left",
   {x, y} = {initialxLeft, 1};
   initialxLeft++;
   leftOrRightToggle = "Right", 
   {x, y} = {initialxRight, 1};
   initialxRight--;
   leftOrRightToggle = "Left"];
  While[x <= n,
   m[[y, x]] = counter;
   counter++;
   x++;
   y++;
   ];
  ];
m

$$\left( \begin{array}{ccccccccc} 0 & f[1] & f[10] & f[19] & f[28] & f[33] & f[25] & f[17] & f[9] \\ 0 & 0 & f[2] & f[11] & f[20] & f[29] & f[34] & f[26] & f[18] \\ 0 & 0 & 0 & f[3] & f[12] & f[21] & f[30] & f[35] & f[27] \\ 0 & 0 & 0 & 0 & f[4] & f[13] & f[22] & f[31] & f[36] \\ 0 & 0 & 0 & 0 & 0 & f[5] & f[14] & f[23] & f[32] \\ 0 & 0 & 0 & 0 & 0 & 0 & f[6] & f[15] & f[24] \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & f[7] & f[16] \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & f[8] \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ \end{array} \right)$$

What it does: start with some point $(x,y)$. Move the point along a diagonal and use a counter to keep track of the current count. When it hits the edge reset back to the top row. leftOrRightToggle keeps track if you should start from the main diagonal or from the corner. initialxleft and initialxRight keep track of the initial x position for starting from the main diagonal or the corner respectivetely. Once initialxleft and initialxRight meet you are done.