On certain permutation groups and sums of two squares