## 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

Started by BMAD, May 11 2013 01:10 AM

9 replies to this topic

### #1

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

### #2

Posted 11 May 2013 - 10:18 AM

Spoiler for Estimate

*The greatest challenge to any thinker is stating the problem in a way that will allow a solution.*

- Bertrand Russell

### #3

Posted 11 May 2013 - 11:32 PM Best Answer

Spoiler for

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

### #4

Posted 12 May 2013 - 12:36 AM

Spoiler for I say it's

### #5

Posted 12 May 2013 - 01:57 AM

Spoiler for

You are very close!

### #6

Posted 12 May 2013 - 01:58 AM

Spoiler for hint for an approach

### #7

Posted 13 May 2013 - 09:50 PM

Spoiler for hint2 Proving a harmonic sum conjecture

### #8

Posted 14 May 2013 - 02:52 PM

with this above hint/spoiler

Spoiler for

### #9

Posted 14 May 2013 - 04:17 PM

I will give it to Phillip but

Spoiler for my precise calculation

### #10

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 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users