Let U be uniformly distributed on the interval $(0,1)$ and $$Y=\frac{\log(1-U)}{\log(1+p)}+1.$$ Then compute $\Bbb{P}(Y=k)$ and use it to provide an algorithm for generating a sample for geometric distribution using a uniform.
I have no idea how to start and solve this, so any help will be really appreciated!
As defined, $\ Y\ $ is continuously distributed (within the interval $\ (-\infty,1)\ $), so $\ \mathbb{P}(Y=k)=0\ $ for every real number $\ k\ $.
However, if $\ k\ $ is an integer not less than $1$, then $\ \mathbb{P}(3-k<Y\le 2-k) =$$ p(1+p)^{-k}\ $, so if you have a sample $\ \tilde{u}\ $ from the uniform distribution, and calculate $\ \tilde{k}=\left\lceil\frac{\log(1-\tilde{u})}{\log(1+p)}+1\right\rceil\ $, then $\ 2-\tilde{k}\ $ will be a sample from the geometric distribution on $\ 1,2,\dots\ $.