I am interested in creating a table with positive Gaussian integers listed in order based on their norms, with ties broken by lex order.
So far I have Sort[Flatten[Table[{a, b, a^2 + b^2}, {a, 0, 10}, {b, 0, 10}], 1], #1[[3]] < #2[[3]] &], 1]
, which gives me some Gaussian integers sorted by norm, but the ties are broken in revlex.
For example, the code gives {1,0,1},{0,1,1} as the first nonzero entries, but I want those to be reversed. A second application of Sort destroys the first Sort, so I need to be more clever, and alas I am not.
Any help would be appreciated.