custom implementation of prime number collector