Here $0\le k\lt n$ and $d\mid n$.
All are positive.
I know that the number of integers satisfying $\gcd(k,n)=1$ is $\phi(n)$.
Initially, I thought that the formula would be simply $\phi(n/d)$ because $\gcd(k,n) = d \implies \gcd(k,n/d)=1$.
Soon I realized that this is a mistake : $\gcd(2, 12) = 2 \not \implies \gcd(2,6)=1$.
So I'm kinda stuck looking for a formula. Appreciate any help. Thanks!
I think your formula is correct, because $\gcd(k,n)=d\Longrightarrow \gcd(k/d,n/d)=1$ and $\gcd(j,n/d)=1 \Longrightarrow \gcd(jd,n)=d$.