Question

Problem 1. Suppose that we take a random sequence of numbers modulo n. The proba- bility that the first k terms are all disti

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The smallest value of k for the part a is 23.

The C program for the solving the above problem is:

#include <iostream>
using namespace std;

int main() {
        int n = 365, i = 1;
        float a, total = 1;
        while(total >= (float)1/2) {
                a = (float)(n-i) / n;
                total *= a;
                i += 1;
        }
        cout << i;
}

The sample of the code is:

1 #include <iostream> 2 using namespace std; 3 49 int main() { 5 int n = 365, i = 1; 6 float a, total = 1; 79 while(total >=

The output of the code is:

C:\Users\user\Desktop\Untitled2.exe 23 Process exited after 0.06519 seconds with return value o icPress any key to continue

The smallest value of k for the part b is 95.

The C program for the solving the above problem is:

#include <iostream>
using namespace std;

int main() {
        int n = 1000, i = 1;
        float a, total = 1;
        while(total >= (float)1/100) {
                a = (float)(n-i) / n;
                total *= a;
                i += 1;
        }
        cout << i;
}

The sample of the code is:

6 1 #include <iostream> 2 using namespace std; 3 4 int main() { 5 int n = 1000, i = 1; 6 float a, total = 1; 7 while(total >=

The output of the code is:

C:\Users\user\Desktop\Untitled2.exe 95 Process exited after 0.06725 seconds with return value o Press any key to continue ...

Comment down if you have any queries regarding the code or understanding. I will help you out as soon as possible.

Add a comment
Know the answer?
Add Answer to:
Problem 1. Suppose that we take a random sequence of numbers modulo n. The proba- bility...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please help me understand this problem. k people in a room. We would like to find...

    please help me understand this problem. k people in a room. We would like to find the probability that any two people 5. Suppose that there are have birthdays within a day of each other (which we'll call "near-day birthdays"). The number of pairs and the probability that any two people are born within a day of each other is of people would be S4Therefore, we would expect the average number of near-day birthday pairs to be be a Poisson...

  • Problem 1. Suppose that a fair six-sided die is rolled n times. Let N be the number of 1's rolled...

    I know Pk~1/k^5/2 just need the work Problem 1. Suppose that a fair six-sided die is rolled n times. Let N be the number of 1's rolled, N2 be the number of 2's rolled, etc, so that NN2+Ns-n Since the dice rolls are independent then the random vector < N,, ,Ne > has a multinomial distribution, which you could look up in any probability textbook or on the web. If n 6k is a multiple of 6, let Pa be...

  • Problem #1: (a) Suppose that we identify 161 women 50 to 54 years of age who...

    Problem #1: (a) Suppose that we identify 161 women 50 to 54 years of age who have both a mother and a sister with a history of breast cancer. 16 of these women themselves have developed breast cancer at some time in their lives. If we assume that the proportion of breast cancer cases in women whose mothers have had breast cancer is 8%, does having a sister with the disease increase the risk? Find the p-value. (b) At the...

  • Problem 5. Indicator variables S points possible (graded) Consider a sequence of n 1 independent tosses...

    Problem 5. Indicator variables S points possible (graded) Consider a sequence of n 1 independent tosses of a biased coin, at times k = 0,1,2,...,n On each toss, the probability of Heads is p, and the probability of Tails is 1 -p {1,2,.., at time for E resulted in Tails and the toss at time - 1 resulted in A reward of one unit is given if the toss at time Heads. Otherwise, no reward is given at time Let...

  • Suppose we are given two sorted arrays (nondecreasing from index 1 to index n) X[1] ·...

    Suppose we are given two sorted arrays (nondecreasing from index 1 to index n) X[1] · · · X[n] and Y [1] · · · Y [n] of integers. For simplicity, assume that n is a power of 2. Problem is to design an algorithm that determines if there is a number p in X and a number q in Y such that p + q is zero. If such numbers exist, the algorithm returns true; otherwise, it returns false....

  • using c++ Problem 1 In this problem, we want to generate N random values of type...

    using c++ Problem 1 In this problem, we want to generate N random values of type integer between 7 and 70 inclusive, and then find their average. Print the average and a sentence "the average is low" if the average is less than 52, "the average is high" if it is more than 52, and "the average is in the middle" if it is 52. Asks how many values to generate (i.e.: N). Generates N values between 7 and 70...

  • Suppose we toss a fair coin every second so the first toss is at time t1. Define a random variabl...

    Suppose we toss a fair coin every second so the first toss is at time t1. Define a random variable Y (the "waiting time for the first head ") by Prove that Yi satisfies (Yİ is said to have geometric distribution with parameter p. (Yi-n) = (the first head occurs on the n-th toss). FOUR STEPS TO THE SOLUTION (1) Express the event Yǐ > n in terms of , where , is the number of heads after n tosses...

  • Problem 1 (5+15 points) Consider the set P of n points and suppose we are given...

    Problem 1 (5+15 points) Consider the set P of n points and suppose we are given the points of P one point at a time. After receiving each point, we compute the convex hull of the points seen so far. (a) As a naive approach, we could run Graham’s scan once for each point, with a total running time of O(n2 log n). Write down the pesuedocode for this algorithm. (b) Develop an O(n2) algorithm to solve the problem. Write...

  • Problem 1. Suppose we are betting money on the outcome of a game of chance with two outcomes (e.g. roulette). If we gue...

    Problem 1. Suppose we are betting money on the outcome of a game of chance with two outcomes (e.g. roulette). If we guess correctly we get double our bet back and otherwise we lose the money we've bet. Consider the strategy where you initially bet one euro and you keep playing and doubling your bet until the first time you win. At that point you go home, having made a net profit. Let p be the probability of winning a...

  • Benfords Law claims that numbers chosen from very large data files tend to have "1" as...

    Benfords Law claims that numbers chosen from very large data files tend to have "1" as the first nonzero digit disproportionately often. In fact, research has shown that if you randomly draw a number from a very large data file, the probability of getting a number with "1" as the leading digit is about 0.301. Suppose you are an auditor for a very large corporation. The revenue report involves millions of numbers in a large computer file. Let us say...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT