# Questions tagged [probability-theory]

Challenges which involve computing probabilities for random variables and stochastic processes.

70 questions
Filter by
Sorted by
Tagged with
2k views

### Odds for second smallest prime factor

Given a prime number $p$ output the asymptotic density of the set of positive integers which have $p$ as their second-smallest distinct prime factor Input/Output Input: one of the following ...
• 12.3k
2k views

### Avoiding Loops!

Given a collection of coloured laces, what would be the probability, $P$, that Alice won't create any loops if, until impossible, they tie two uniformly chosen, free lace ends of differing colours ...
• 107k
1k views

### Compute probability of seeing all the balls

Given $x$ distinguishable balls (say they have different colors), sample with replacement repeatedly until all the balls that have been seen, have been seen at least twice. Challenge The input is ...
• 2,936
2k views

### Random factorized numbers

Input The code should take an integer $n$ between 1 and 1000. Output The code should output positive integers with $n$ bits. Accompanying each integer should be its full factorization. Each ...
• 2,936
521 views

### Pick a random string at a fixed edit distance

I have string $s$ of length $n$ and some constant integer $k$ which is at most $n$. Give the fastest algorithm to sample a random string with Levenshtein distance $k$ from $s$ uniformly. ...
• 2,936
1k views

### Weighted coin flip strings

Given n, k, and p, find the probability that a weighted coin with probability p of heads will flip heads at least k times in a row in n flips, correct to 3 decimal digits after decimal point (changed ...
• 193
2k views

### Sample integers that sum to one hundred

Given a positive integer n, randomly output n non negative integers that sum to one hundred. n will be at most 200. The output should be present as a list of integers (not sorted). Your random sample ...
189 views

### Calculate the probability of getting this hand in n tries [closed]

Imagine there is a card game where the primary objective of the game is to get 4 of one card in your hand. Game mechanics Each player starts of with 10 cards in their hand. The remaining 32 cards (...
• 227
739 views

### Yet another coin flipping problem

Problem Starting with a set of 10 coins at the start where all coins are tails up, and given n number of integers $x_1, x_2, x_3... x_n$ representing n rounds of coin flipping. At each round, we ...
• 141
201 views

### A Suitable Mission — The Professor's Revenge

Summer Klerance turned in her term assignment for this challenge. Her professor was miffed (but also amused) when he overheard a disgruntled classmate of Summer's saying she got her answers by ...
• 636
468 views

### A Suitable Mission

Summer Klerance, a senior in college, is what her teachers refer to as GBL*. Students in her probability class have been assigned individual problems to work on and turn in as part of their final ...
• 636
1k views

### Odds that a string of N digits contains two or more of the same

I have to fill in 2fa codes all day. They're 6-digit strings. One day I noticed that not once did any of these codes contain 6 unique digits, like 198532 There was always at least one double, like ...
• 1,304
2k views

### Calculate the probability of getting to the target first (exactly)

Consider the following probability puzzle. We start with a string of bits all set to 0. At each step we choose a bit uniformly and independently at random and flip it. The value your code has to ...
2k views

### Lucky dice rolls

Lucky dice rolls In pen and paper roleplaying games dice are used for various chance calculations. The usual way to describe a roll is $n\textbf{d}k$ where $n$ is the number of dice and $k$ is ...
• 3,457
1k views

### Penney-Conway odds

Background Penney's game is a two-player game about coin tossing. Player A announces a sequence of heads and tails of length $n$, then player B selects a different sequence of same length. The ...
• 77k
262 views

### Estimate the mean minimum Hamming distance

Task Inputs $b \leq 100$ and $n \geq 2$. Consider $n$ binary strings, each of length $b$ sampled uniformly and independently. We would like to compute the expected minimum Hamming distance ...
2k views

• 89.8k
205 views

### Talent rolls in DSA

Some friends and I have played some DSA (a mainly german tabletop RPG much like D&D). I was wondering what the chance on passing rolls are, so you will have to write some code to calculate it. ...
• 2,625
301 views

### Card pair probability

Given a deck consisting of N copies of cards with integer values [1,M] for a total of N*M cards, compute the probability that a card with the value of 1 is adjacent to a card with the value of 2. ...
• 2,733
3k views

### 1/N probability

Because there are not enough simple code-golf challenges: Create an optionally unnamed program or function that, given (by any means) an integer 1 ≤ N ≤ 10000, outputs your language's True value with ...
• 30.4k
342 views

### Guess the hidden communities

Background This challenge is about the stochastic block model. Basically, you are given an undirected graph, where the nodes represent people, and the edges represent social connections between them. ...
• 42.7k
587 views

### Who's that probability distribution?

Introduction In this challenge, you are given a list of nonnegative floating point numbers drawn independently from some probability distribution. Your task is to infer that distribution from the ...
• 42.7k
2k views

### "i" have "i" chance of occuring

Design a random number generator where the i th number has i% chance of occurring for all 0 < i < 14. 0 should have exactly 9% chance of occurring. The seed for the generator should be the ...
• 3,301