I have to assume that when you say "a certain class of integers" you mean a congruence class, something like the integers in an arithmetic progression a+n b. In that case this is not difficult. Given two numbers A,B, B>A, the number of integers in an arithmetic progression a+n b that are equal to or between two Numbers A, B , and therefore the number of terms in the required sum is [(B-a)/b]-[(A-a)/b] where [] denotes the integer part of the quantity in the brackets. A more interesting question is: given the integers A, B and an arithmetic progression (a,b) to come up with upper and lower bounds for the sum of the reciprocals of the terms in the arithmetic progression that are between or equal to A,B.