Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1001573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:41:44+00:00 2026-05-16T07:41:44+00:00

I have a probability problem, which I need to simulate in a reasonable amount

  • 0

I have a probability problem, which I need to simulate in a reasonable amount of time. In simplified form, I have 30 unfair coins each with a different known probability. I then want to ask things like “what is the probability that exactly 12 will be heads?”, or “what is the probability that AT LEAST 5 will be tails?”.

I know basic probability theory, so I know I can enumerate all (30 choose x) possibilities, but that’s not particularly scalable. The worst case (30 choose 15) has over 150 million combinations. Is there a better way to approach this problem from a computational standpoint?

Any help is greatly appreciated, thanks! 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:41:45+00:00Added an answer on May 16, 2026 at 7:41 am

    You can use a dynamic programming approach.

    For example, to calculate the probability of 12 heads out of 30 coins, let P(n, k) be the probability that there’s k heads from the first n coins.

    Then P(n, k) = p_n * P(n – 1, k – 1) + (1 – p_n) * P(n – 1, k)

    (here p_i is the probability the i’th coin is heads).

    You can now use this relation in a dynamic programming algorithm. Have a vector of 13 probabilities (that represent P(n – 1, i) for i in 0..12). Build a new vector of 13 for P(n, i) using the above recurrence relation. Repeat until n = 30. Of course, you start with the vector (1, 0, 0, 0, …) for n=0 (since with no coins, you’re sure to get no heads).

    The worst case using this algorithm is O(n^2) rather than exponential.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 497k
  • Answers 497k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The best solution I managed to reach is a Model… May 16, 2026 at 11:55 am
  • Editorial Team
    Editorial Team added an answer You never cease to amaze me, I__! How many projects… May 16, 2026 at 11:55 am
  • Editorial Team
    Editorial Team added an answer According to the docs for STSADM -o UpdateAlertTemplate you can… May 16, 2026 at 11:55 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a bunch of floating point numbers (Java doubles), most of which are
There was a post on here recently which posed the following question: You have
I have a bunch of data coming in (calls to an automated callcenter) about
I am trying to implement non-uniform probability distribution in genetic algorithm. In the implementation
Suppose we have two longs, x and y. What operator or function involving x
Ok, so here is a problem analogous to my problem (I'll elaborate on the
Let's suppose I have a struct like this: struct my_struct { int a; int
I have a C file running on Linux. It prints some lines in red
I seem to be having trouble with this. I have a Task table with
Have noticed issue while testing iphone app that if one quickly opens/dismisses a modal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.