I'm generating random binary sequences of fixed length N
Example with N=10: 0101011100, this one has x=5 1's
How often do I have to generate such a sequence until I get one with at least x 1's on average?
The order or position of these 1's doesn't matter, only their number.
Here is a plot for N=100

The total number of possible binary sequences of length N is $ 2^n $
The number of ways k 1's can be ordered in a sequence of length N is $ C(N,k) $
So to get the number of ways k>=x 1's can be ordered we just add all k<x together and subtract that from the total number of possibilities:
$$ 2^n - \sum_{k=0}^{x-1} C(N,k) $$
To get the probability of getting one of these combinations in a single attempt, we divide this by the total number of sequences.
$$ p = \frac{2^n - \sum_{k=0}^{x-1} C(N,k)}{2^n} $$
The average number of tosses to reach a head with an unfair coin with success probability $ p $ is apparently just $ 1/p $ so we get
$$ expected = \frac{2^n}{2^n - \sum_{k=0}^{x-1} C(N,k)} $$
and this agrees with the simulation
and allows one to calculate and plot values beyond the ones that can be computed in reasonable time (here with a logarithmic y-axis because it grows so fast)