I'm struggling with the following problem:
An electronic circuit has $X$ components. The circuit works only if all its components work. Suppose $Y$ components are defective. A component is randomly selected and tested; if defective, then it is replace by a component that works, next the circuit is checked again. If the circuit still not working this process is repeated again All circuit components are equally likely to be selected even if it has been previously tested. shows that the expected number of tests until the circuit work (for large $X$ and $Y$) is : $X(\log(Y)+\gamma)$
$\gamma $:= Euler's constant
Any hints please.
We assume there are $k$ components of which $d$ are defective. The probability that on any trial we find and fix a defective is $\frac{d}{k}$. So the number of trials until we fix the first defective has geometric distribution, parameter $\frac{d}{k}$, so expectation $\frac{k}{d}$.
Once we have fixed the first defective, there are $d-1$ left, so the mean additional waiting time until we find and fix the next is $\frac{k}{d-1}$. Continue. The expected waiting time until we have found and fixed all the defectives is $$k\left(1+\frac{1}{2}+\cdots+\frac{1}{d}\right)$$ (we reversed the order of summation to make things look nicer).
So the expectation is $kH(d)$, where $H(d)$ is the $d$-th harmonic number. Please see Wikipedia for estimates of $H(n)$. The main term is $\ln n$. A better estimate is $\ln n+\gamma$, where $\gamma\approx 0.577$ is the Euler-Mascheroni constant (not $e$).
Remark: For a more standard related problem, please see the Coupon Collector's Problem.