Question

Consider the above quadratic residue generator xn+1 = xn2 mod m with m = 4783 ×...

Consider the above quadratic residue generator xn+1 = xn2 mod m with m = 4783 × 4027. Write a program to generate pseudo-random numbers from this generator. Use this to determine the period of the generator starting with seed x0 = 196, and with seed x0 = 400?

Homework Answers

Answer #1

The R program is

x={}

x0 = 196# seed

x[1]=x0

m =4783*4027

k=1 # how many next random numbers you want

for(n in 1:k){

x[n+1] =(x[n]^2)%%m

}

x

[1]   196 38416

#The Output is Seed and next random numbers

x0 = 400 # seed

x[1]=x0

m =4783*4027

k=1 # how many next random numbers you wants

for(n in 1:k){

x[n+1] =(x[n]^2)%%m

}

x

[1]    400 160000

# The output is Seed and next random numbers

x={}
x0 = 196
x[1]=x0
m =4783*4027
k=10
for(n in 1:k){
x[n+1] =(x[n]^2)%%m
}
x

 [1]      196    38416 11942340   179421  6528630 11496859 16561776  4718361
 [9] 17746035  3406856   543841

x0 = 400
x[1]=x0
m =4783*4027
k=10
for(n in 1:k){
x[n+1] =(x[n]^2)%%m
}
x

[1]      400   160000  1943611 13179555  2320953  1741316 15551072  3530790
 [9] 12690106 11484744 14234586
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
27.2 Generate 15 numbers using a seed of x0 = 1 in the following generator: xn...
27.2 Generate 15 numbers using a seed of x0 = 1 in the following generator: xn = (5xn-1+ 1) mod16
27.2 Generate 15 numbers using a seed of x0 = 1 in the following generator: xn...
27.2 Generate 15 numbers using a seed of x0 = 1 in the following generator: xn = (5xn-1 + 1) mod16. Perform a K-S test and check whether the sequence passes the test at a 95% confidence level.
Consider m=24, i.e., Xn+1 =(aXn) mod 24. (Hint: This is a common case for a linear...
Consider m=24, i.e., Xn+1 =(aXn) mod 24. (Hint: This is a common case for a linear congruential algorithm when m is a power of 2.) What restrictions are required on the seed?
Consider the linear congruential algorithm with an additive component of 0, i.e., Xn+1 =(aXn) mod m...
Consider the linear congruential algorithm with an additive component of 0, i.e., Xn+1 =(aXn) mod m a. It can be shown that if m is prime and if a given value of a produces the maximum period of m-1, then akwill also produce the maximum period, provided that k is less than m and that k and m-1 are relatively prime. Demonstrate this by using X0=1 and m=31 and producing the sequences for ak = 3, 32, 33, and 34.
Consider m=24, i.e., Xn+1 =(aXn) mod 24. (Hint: This is a common case for a linear...
Consider m=24, i.e., Xn+1 =(aXn) mod 24. (Hint: This is a common case for a linear congruential algorithm when m is a power of 2.) What should be the value of a to achieve the maximum period?
1) Consider a linear congruential random number generator with parameters a = 35, c = 20...
1) Consider a linear congruential random number generator with parameters a = 35, c = 20 and m = 100. a- Generate 5 random numbers by using this method. Use 84. b- By using inverse transform method, generate 2 random variate for an exponential distribution with parameter λ = 0.5. Use the first two random numbers you generated in part a.
1. Consider the Markov chain {Xn|n ≥ 0} associated with Gambler’s ruin with m = 3....
1. Consider the Markov chain {Xn|n ≥ 0} associated with Gambler’s ruin with m = 3. Find the probability of ruin given X0 = i ∈ {0, 1, 2, 3} 2 Let {Xn|n ≥ 0} be a simple random walk on an undirected graph (V, E) where V = {1, 2, 3, 4, 5, 6, 7} and E = {{1, 2}, {1, 3}, {1, 6}, {2, 4}, {4, 6}, {3, 5}, {5, 7}}. Let X0 ∼ µ0 where µ0({i}) =...
Consider a satellite of mass m in a circular orbit of radius r around the Earth...
Consider a satellite of mass m in a circular orbit of radius r around the Earth of mass ME and radius RE. 1. What is the gravitational force (magnitude and direction) on the satellite from Earth? 2. If we define g(r) to be the force of gravity on a mass m at a radial distance r from the center of the Earth, divided by the mass m, then evaluate the ratio g(r)/g(RE)to see how g varies with radial distance. If...
Q1d08A.) Edward Shack is conducting a simulation of a serial production line for Lowliner Foods in...
Q1d08A.) Edward Shack is conducting a simulation of a serial production line for Lowliner Foods in St John’s, NL. The line processes fresh fish into frozen fish fingers. The line operates on three shift basis, 7.5 hours per shift, with a half-hour between shifts. Machines are idled between the shifts. a.) Mr. Shack is very interested in determining the effect of unscheduled downtime of the flash freezing unit on shift output. Eddie has implemented a data collection procedure that will...
1. A 25 kg skydiver has a speed of 20 m/s at an altitude of 350...
1. A 25 kg skydiver has a speed of 20 m/s at an altitude of 350 m above the ground. Determine the kinetic energy possessed by the skydiver. 2. If a cruise ship travels 150 km to the south and then 250 km to the west, what is the ship’s displacement from its starting point? 3. A train is accelerating at a rate of 5 m/s . If its initial velocity is 15 m/s, what is its speed after 10...