(MAGMA) lst:=[]; for e in [1..3] do a:=Truncate((10^e-1)/9); for x in [1..9] do n:=a*x; f:=Factorization(n); if IsSquare(n) and not IsZero([x: x in [1..#f] | f[x][1] mod 4 eq 1]) or not IsSquare(n) and IsZero([x: x in [1..#f] | IsOdd(f[x][2]) and f[x][1] mod 4 eq 3]) then Append(~lst, n); end if; end for; end for; lst;