You can put this solution on YOUR website!
Extend a line from the top of the block to the vertical line thru the center of the pipe.
You get a right triangle with r as the hypotenuse.
If you solve that you'll get 6 ± sqrt(10)
6 - sqrt(10) is the answer.
6 + sqrt(10) puts the block on the other side of the pipe, between the pipe and the wall.
btw, that's not a "large" pipe, less than 3 ft OD.