TITLE: A question on the prime divisors of p-1
QUESTION [18 upvotes]: For each positive integer n we may define the convergent sum $$ s(n)=\sum_{p}\frac{(n,p-1)}{p^2} $$
where the summation is over primes p and $(a,b)$ denotes the greatest common divisor of a,b.
It is immediate to deduce that s(n) is bounded on average: 
Using $\sum \limits_{d|a, d|b}\phi(d)=(a,b)$ and inverting the order of summation we get
$s(n)=\sum_{d|n}\phi(d) a_d$ where $a_d=\sum_{p \equiv 1 (mod  \ d)}p^{-2}  $
Ignoring the fact that we sum over primes we get the bound $a_d \ll \frac{1}{d^2}$ which leads to $$\sum_{n \leq x}s(n) \ll x \sum_{d \geq 1}\frac{\phi(d)a_d}{d}=O(x) $$
and $$s(n) \ll  \exp(\sum_{p|n}\frac{1}{p}).$$ The last inequality  means that $s(n)$ stays bounded if $\omega(n)$ is 
bounded. Towards the other direction, it seems fair to expect 
that $s(n)$ grows to infinity if $\omega(n)$ is large in some quantitative sense, say 
$\omega(n) \geq (1+\epsilon) \log \log n$. Taking into account that the contribution to the sum $s(n)$ of the primes $p$ that satisfy $(p-1,n) \leq \frac{p}{\log p}$  is bounded, since $\sum_{p}\frac{1}{p \log p}$ converges, we see that $ s(n)=s'(n)+O(1)$ where $s'(n)=\sum_{ (p-1,n)>\frac{p}{\log p}} \frac{(n,p-1)}{p^2}$ We are therefore led  to the question as to whether a condition of the form $\frac{\omega(n)}{\log \log n}-1 \gg 1$ can guarantee that $s'(n) \to +\infty$ Are there any non-trivial techniques that can be used to answer this question ?

REPLY [9 votes]: Your guess that $s(n)$ gets large if $\omega(n)$ is large is not correct.
It is possible for $n$ to have many primes, and for $s(n)$ still to be small. 
This can be seen from some of the work in your question.  As you note $s(n) =\sum_{d|n} \phi(d) a_d$ where $a_d =\sum_{p\equiv 1\pmod d} p^{-2} \ll 1/d^2$.  Therefore 
$$ 
s(n) \ll \sum_{d|n} \frac{1}{d} \le \prod_{p|n} \Big(1-\frac 1p\Big)^{-1}. 
$$ 
If now every prime factor of $n$ exceeds $\log n$, then (since $\omega(n) \le \log n$ 
trivially) we have 
$$ 
s(n) \ll \Big(1-\frac{1}{\log n} \Big)^{-\log n} \ll 1.
$$ 
Thus $n$ can have about $\log n/\log \log n$ prime factors, all larger than $\log n$ 
and still $s(n)$ would be $\ll 1$.