8
$\begingroup$

Given an integer $x_0$. Randomly select integers $x_{i+1}\in\{1,\dots ,x_i\}$ uniformly distributed to get a sequence $$x_0\ge x_1\ge\cdots\ge x_{n}=1$$ What is the probability for all of the $x_i$:s, $0

Erroneous: There is a claim that this probability is $\frac{1}{x_0}$ but my computationally results suggest a far greater probability.

  • 1
    https://en.wikipedia.org/wiki/Prime_number_theorem <-- using an integral over this formula for probability of one sampling resulting in a prime. But then we will need to build a product of such samplings somehow.2017-02-03
  • 2
    I don't see the claim you mention in the link. The multiplicative factor of $\frac rN$ is inserted to produce uniformity. The probability of generating $r=1$ (i.e. an all composite sequence) is given as $\prod (1-\frac 1p)$ where $p$ runs through the primes less than $N$.2017-02-03
  • 0
    What if $x_0=3$? it always gives primes!2017-02-03
  • 0
    @lulu: Thanks! I missed the correction with $r/N$. :)2017-02-03

1 Answers 1

1

[Sorry this is not an answer, but more like a discussion. I am new here and unsure how to post something like this, since it wont fit in the comments...]

The way I understand the problem statement, if some $x_i$ happens to be very small then the rest of the chain will be rather short, i.e. $n-i$ will also be small. So it is not just a matter of whether the next number is non-prime but also its size is critical. This suggests a recurrence (dynamic programming) to me.

Let $p(x)$ denote the probability of starting at $x_0=x$ and having all $x_i: 0 < i \le n$ be non-prime (so this allows $x_n=1$, which is non-prime). A recurrence can be written by considering the next number picked, $y$. First, each $y \in \{1,..., x\}$ is picked with uniform probability $\frac{1}{x}$. Second, if you pick a non-prime $y$ you can continue, whereas if you pick a prime $y$ you have failed. So the recurrence would be:

$$p(x) = \frac{1}{x} \sum_{non\ prime\ y \le x} p(y), \forall x$$

The above works for both prime and non-prime $x$, and in case $x$ is prime, the $\le$ sign can be replaced with $<$. In case $x$ is not prime, then $p(x)$ appears on both side of the equation and cancelling the term is helpful:

$$p(x) = \frac{1}{x-1} \sum_{non\ prime\ y < x} p(y), \forall\ non\ prime\ x$$

All summations include $y=1$ and we also need $p(1)=1$.

I am not sure how to proceed from this recurrence, e.g. to seek a closed-form solution or approximation, but it can be iterated easily: $p(1)=1, \ p(2)=\frac{1}{2},\ p(3)=\frac{1}{3}, \ p(4)=\frac{1}{3}, \ p(5)=\frac{1}{5}(p(1)+p(4)) = \frac{4}{15}$ etc.

Am I on the right track?