check only numbers after the current one, to exclude the case where a
number will be counted twice