## Welcome to BrainDen.com - Brain Teasers Forum

 Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account. As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends. Of course, you can also enjoy our collection of amazing optical illusions and cool math games. If you like our site, you may support us by simply clicking Google "+1" or Facebook "Like" buttons at the top. If you have a website, we would appreciate a little link to BrainDen. Thanks and enjoy the Den :-)
Guest Message by DevFuse

# Random Number Generation

9 replies to this topic

Senior Member

• Members
• 1837 posts
• Gender:Female

Posted 11 May 2013 - 01:10 AM

Inspired by the witty code of BobbyGo

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
x = x + 1
end-do

• 0

### #2 bonanova

bonanova

bonanova

• Moderator
• 6158 posts
• Gender:Male
• Location:New York

Posted 11 May 2013 - 10:18 AM

Spoiler for Estimate

• 0

Vidi vici veni.

### #3 phil1882

phil1882

Senior Member

• Members
• 564 posts

Posted 11 May 2013 - 11:32 PM   Best Answer

Spoiler for

Edited by phil1882, 11 May 2013 - 11:35 PM.

• 0

### #4 superprismatic

superprismatic

Not just Prismatic

• Moderator
• 1281 posts
• Gender:Male

Posted 12 May 2013 - 12:36 AM

Spoiler for I say it's

• 0

Senior Member

• Members
• 1837 posts
• Gender:Female

Posted 12 May 2013 - 01:57 AM

Spoiler for

You are very close!

• 0

Senior Member

• Members
• 1837 posts
• Gender:Female

Posted 12 May 2013 - 01:58 AM

Spoiler for hint for an approach

• 0

Senior Member

• Members
• 1837 posts
• Gender:Female

Posted 13 May 2013 - 09:50 PM

Spoiler for hint2 Proving a harmonic sum conjecture

• 0

### #8 dark_magician_92

dark_magician_92

• Members
• 382 posts

Posted 14 May 2013 - 02:52 PM

with this above hint/spoiler
Spoiler for

• 0

Senior Member

• Members
• 1837 posts
• Gender:Female

Posted 14 May 2013 - 04:17 PM

I will give it to Phillip but

Spoiler for my precise calculation

• 0

### #10 dark_magician_92

dark_magician_92

• Members
• 382 posts

Posted 14 May 2013 - 07:48 PM

oh yeah i forgot expected value can be a fractions. Your eatimation is right, i rounded it off without thinking.
• 0

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users