title: Algorithm that fills entries diagonally
body: <p>Suppose i have a matrix <code>A</code> of <code>n*n</code> and want to fill entries diagonally. 
  First i want to fill main diagonal then the diagonal above the main diagonal and up to so on.
  Then diagonal below the main diagonal</p>
  
  <p><img src="https://latex.codecogs.com/gif.latex?%5Cbegin%7Bbmatrix%7D&space;%7B%5Ccolor%7BRed%7D&space;a_%7B11%7D%7D&amp;&space;%7B%5Ccolor%7BGreen%7D&space;a_%7B12%7D%7D&amp;&space;%7B%5Ccolor%7BBlue%7D&space;a_%7B13%7D%7D&space;&amp;&space;.&space;&amp;&space;.&space;&amp;&space;.&space;&amp;&space;.&space;&amp;&space;.%5C%5C&space;%7B%5Ccolor%7BPurple%7D&space;a_%7B21%7D%7D&space;&amp;&space;%7B%5Ccolor%7BRed%7D&space;a_%7B22%7D%7D&amp;&space;%7B%5Ccolor%7BGreen%7D&space;a_%7B23%7D%7D&space;&amp;&space;%7B%5Ccolor%7BBlue%7D&space;a_%7B24%7D%7D&amp;&space;.&space;&amp;&space;.&space;&amp;&space;.&amp;&space;.&space;%5C%5C&space;%7B%5Ccolor%7BOrange%7D&space;a_%7B31%7D%7D&space;&amp;&space;%7B%5Ccolor%7BPurple%7D&space;a_%7B32%7D%7D&amp;&space;%7B%5Ccolor%7BRed%7D&space;a_%7B33%7D%7D&space;&amp;&space;%7B%5Ccolor%7BGreen%7D&space;a_%7B34%7D%7D&space;&amp;&space;%7B%5Ccolor%7BBlue%7D&space;a_%7B35%7D%7D&amp;&space;.&space;&amp;&space;.&space;&amp;&space;.%5C%5C&space;.&space;&amp;&space;%7B%5Ccolor%7BOrange%7D&space;a_%7B42%7D%7D&space;&amp;&space;%7B%5Ccolor%7BPurple%7D&space;a_%7B43%7D%7D&space;&amp;&space;%7B%5Ccolor%7BRed%7D&space;a_%7B44%7D%7D&space;&amp;&space;%7B%5Ccolor%7BGreen%7D&space;a_%7B45%7D%7D&space;&amp;&space;%7B%5Ccolor%7BBlue%7D&space;a_%7B46%7D%7D&amp;&space;.&space;&amp;&space;.%5C%5C&space;.&space;&amp;&space;.&space;&amp;&space;%7B%5Ccolor%7BOrange%7D&space;a_%7B53%7D%7D&space;&amp;&space;%7B%5Ccolor%7BPurple%7D&space;a_%7B54%7D%7D&space;&amp;%7B%5Ccolor%7BRed%7D&space;a_%7B55%7D%7D&space;&amp;&space;%7B%5Ccolor%7BGreen%7D&space;a_%7B56%7D%7D&space;&amp;&space;%7B%5Ccolor%7BBlue%7D&space;a_%7B57%7D%7D&amp;&space;.%5C%5C&space;.&amp;&space;.&space;&amp;&space;.&space;&amp;&space;%7B%5Ccolor%7BOrange%7D&space;a_%7B64%7D%7D&space;&amp;&space;%7B%5Ccolor%7BPurple%7D&space;a_%7B65%7D%7D&space;&amp;%7B%5Ccolor%7BRed%7D&space;a_%7B66%7D%7D&space;&amp;&space;%7B%5Ccolor%7BGreen%7D&space;a_%7B67%7D%7D&space;&amp;&space;%7B%5Ccolor%7BBlue%7D&space;a_%7B68%7D%7D%5C%5C&space;.&amp;&space;.&amp;&space;.&space;&amp;&space;.&space;&amp;&space;%7B%5Ccolor%7BOrange%7D&space;a_%7B75%7D%7D&space;&amp;&space;%7B%5Ccolor%7BPurple%7D&space;a_%7B76%7D%7D&space;&amp;&space;%7B%5Ccolor%7BRed%7D&space;a_%7B77%7D%7D&space;&amp;&space;%7B%5Ccolor%7BGreen%7D&space;a_%7B78%7D%7D%5C%5C&space;.&amp;&space;.&space;&amp;.&space;&amp;&space;.&space;&amp;&space;.&space;&amp;%7B%5Ccolor%7BOrange%7D&space;a_%7B86%7D%7D&space;&amp;%7B%5Ccolor%7BPurple%7D&space;a_%7B87%7D%7D&space;&amp;&space;%7B%5Ccolor%7BRed%7D&space;a_%7B88%7D%7D&space;%5Cend%7Bbmatrix%7D" title="\begin{bmatrix} {\color{Red} a_{11}}&amp; {\color{Green} a_{12}}&amp; {\color{Blue} a_{13}} &amp; . &amp; . &amp; . &amp; . &amp; .\\ {\color{Purple} a_{21}} &amp; {\color{Red} a_{22}}&amp; {\color{Green} a_{23}} &amp; {\color{Blue} a_{24}}&amp; . &amp; . &amp; .&amp; . \\ {\color{Orange} a_{31}} &amp; {\color{Purple} a_{32}}&amp; {\color{Red} a_{33}} &amp; {\color{Green} a_{34}} &amp; {\color{Blue} a_{35}}&amp; . &amp; . &amp; .\\ . &amp; {\color{Orange} a_{42}} &amp; {\color{Purple} a_{43}} &amp; {\color{Red} a_{44}} &amp; {\color{Green} a_{45}} &amp; {\color{Blue} a_{46}}&amp; . &amp; .\\ . &amp; . &amp; {\color{Orange} a_{53}} &amp; {\color{Purple} a_{54}} &amp;{\color{Red} a_{55}} &amp; {\color{Green} a_{56}} &amp; {\color{Blue} a_{57}}&amp; .\\ .&amp; . &amp; . &amp; {\color{Orange} a_{64}} &amp; {\color{Purple} a_{65}} &amp;{\color{Red} a_{66}} &amp; {\color{Green} a_{67}} &amp; {\color{Blue} a_{68}}\\ .&amp; .&amp; . &amp; . &amp; {\color{Orange} a_{75}} &amp; {\color{Purple} a_{76}} &amp; {\color{Red} a_{77}} &amp; {\color{Green} a_{78}}\\ .&amp; . &amp;. &amp; . &amp; . &amp;{\color{Orange} a_{86}} &amp;{\color{Purple} a_{87}} &amp; {\color{Red} a_{88}} \end{bmatrix}" /></p>
  
  <p>First i want to fill main diagonal that is in <code>red</code> color, then the diagonal above it that is in <code>green</code> color, then diagonal below main diagonal that is in <code>purple</code> color. </p>
  
  <p>Then main concept is after then main diagonal is filled i want to fill the diagonal above it ,then below it, then above it, the below it until matrix is filled.</p>
  
  <p>Suppose i have entries <code>1-64</code> that i want to fill diagonally.</p>