# [R], 84 bytes Or **[R]>=4.1, 77 bytes** by replacing the word `function` with a `\`. <!-- language-all: lang-r --> function(n){m=t(s<-n^2) while(F<s-1){a=nrow(m) m=rbind(s-a:1-F,t(m[a:1,])) F=F+a} m} [Try it online!][TIO-kyxgnr1z] [R]: https://www.r-project.org/ [TIO-kyxgnr1z]: https://tio.run/##FcbBCoMwDADQe74kYRZWwYuYa39iTOg2iwUToe3wIH571cvjpRq4hr9@S1wVlXbhgnkwOrYE2xyXCd2QjaXds6Z1QyEQTp@oP8zG99a4pqC8rjVvInDsHv4AOWpASxCwvelu7JPqCQ "R – Try It Online" Uses the common "rotate and add a row on top" approach. Probably missed some trivial golf, but I'm looking at this for too long already...