PHP 7 (Safe)
Original Code
for($z=0,$q="";$z<($x=$argv[1])**2;){$w=($d=intdiv($z,$x))%2?($d+1)*$x-$z%$x:($z+1);for($f=0;$f<(log10($x**2)^0)-(log10($w)^0);$f++)$q.="\x20";$q.=++$z%$x?"$w\x20":"$w\n";}print(rtrim($q)); Second Try
Regex (PCRE): 29 Bytes
^[^A-Z#\/\s\>busy_heck]{189}$ No space, No comments, no use of base64_decode.
Many functions are not allowed! underscore
Output n=11
1 2 3 4 5 6 7 8 9 10 11 22 21 20 19 18 17 16 15 14 13 12 23 24 25 26 27 28 29 30 31 32 33 44 43 42 41 40 39 38 37 36 35 34 45 46 47 48 49 50 51 52 53 54 55 66 65 64 63 62 61 60 59 58 57 56 67 68 69 70 71 72 73 74 75 76 77 88 87 86 85 84 83 82 81 80 79 78 89 90 91 92 93 94 95 96 97 98 99 110 109 108 107 106 105 104 103 102 101 100 111 112 113 114 115 116 117 118 119 120 121 Output n=4
1 2 3 4 8 7 6 5 9 10 11 12 16 15 14 13 Output n=3
1 2 3 6 5 4 7 8 9