A random number generator generates integers in the range 1...n, where n is a parameter passed into the generator. The output from the generator is repeatedly passed back in as the input. If the initial input parameter is one googol (10100), find, to the nearest integer, the expected value of the number of iterations by which the generator first outputs the number 1. That is, what is the expected value of x, after running the following pseudo-code?

n = 10100

x = 0

do while (n > 1)

n = random(n) // Generates random integer in the range 1...n

## Share this post

## Link to post

## Share on other sites