In this paper we study the sum , where denotes the number of divisors of n, and {np} is a sequence of integers indexed by primes. Under certain assumptions we show that the aforementioned sum is . As an application, we consider the case where the sequence is given by the Fourier coefficients of a modular form.