calculating a sum of squares of some integers, excepting negatives