Expected Number Of Powers Of Two In Decreasing Series

88 Views Asked by At

If I have $100$ dollars and I spend it all in a series of transactions costing a random whole number of dollars from $1$ dollar to however much I have at that time, what is the expected number of dollar values I will have at any point had that are powers of $2$?

For example, $100 \to 64 \to 23 \to 16 \to 9 \to 8 \to 4 \to 1 \to 0$ contains 5 powers of 2.

What if I have $128$ dollars? Is there a closed form for the expected number of powers of $2$ found in the sequence, given how many dollars I start with?

3

There are 3 best solutions below

0
On BEST ANSWER

Let $(X_n)_{n\geq 0}$ denote the sequence you get (just pad it with infinitely many $0$s if you want). Then we have $$P(\exists n \geq 0, X_n = j | X_0 = i) = \begin{cases}\frac{1}{1+j} & i > j\geq0 \\ 1 & i=j \\ 0 & i < j\end{cases}$$

You are asking for the value of the sum $$\sum_{k=0}^\infty P(\exists n\geq 0, X_n = 2^k | X_0=x)$$ If $x$ is a power of two, this has the form: $$1 + \sum_{k=0}^{\log_2(x)-1} \frac{1}{1+2^k}$$ If $x$ isn't a power of two, it has the form: $$\sum_{k=0}^{\lfloor \log_2(x)\rfloor} \frac{1}{1+2^k}$$


Note: Wolfram Alpha gives the closed form of this sum in terms of the "q-digamma" function, which I personally had never even heard of before, so as far as I'm concerned, that sum is the most simplified I can give the answer.

0
On

Here's a simple python script:

from fractions import Fraction

power2 = [2**n for n in range(11)]

E= { }
E[0] = 0 
E[1] = 1
for n in range(2,129):
    E[n] = (n in power2) + Fraction(sum(E[k] for k in range(n)), n)
for n in range(129): print(n, E[n])

This produces nothing particularly interesting:

0 0
1 1
2 3/2
3 5/6
4 11/6
5 31/30
6 31/30
7 31/30
8 61/30
9 103/90
10 103/90
11 103/90
12 103/90
13 103/90
14 103/90
15 103/90
16 193/90
17 1841/1530
18 1841/1530
19 1841/1530
20 1841/1530
21 1841/1530
22 1841/1530
23 1841/1530
24 1841/1530
25 1841/1530
26 1841/1530
27 1841/1530
28 1841/1530
29 1841/1530
30 1841/1530
31 1841/1530
32 3371/1530
33 20761/16830
34 20761/16830
35 20761/16830
36 20761/16830
37 20761/16830
38 20761/16830
39 20761/16830
40 20761/16830
41 20761/16830
42 20761/16830
43 20761/16830
44 20761/16830
45 20761/16830
46 20761/16830
47 20761/16830
48 20761/16830
49 20761/16830
50 20761/16830
51 20761/16830
52 20761/16830
53 20761/16830
54 20761/16830
55 20761/16830
56 20761/16830
57 20761/16830
58 20761/16830
59 20761/16830
60 20761/16830
61 20761/16830
62 20761/16830
63 20761/16830
64 37591/16830
65 273259/218790
66 273259/218790
67 273259/218790
68 273259/218790
69 273259/218790
70 273259/218790
71 273259/218790
72 273259/218790
73 273259/218790
74 273259/218790
75 273259/218790
76 273259/218790
77 273259/218790
78 273259/218790
79 273259/218790
80 273259/218790
81 273259/218790
82 273259/218790
83 273259/218790
84 273259/218790
85 273259/218790
86 273259/218790
87 273259/218790
88 273259/218790
89 273259/218790
90 273259/218790
91 273259/218790
92 273259/218790
93 273259/218790
94 273259/218790
95 273259/218790
96 273259/218790
97 273259/218790
98 273259/218790
99 273259/218790
100 273259/218790
101 273259/218790
102 273259/218790
103 273259/218790
104 273259/218790
105 273259/218790
106 273259/218790
107 273259/218790
108 273259/218790
109 273259/218790
110 273259/218790
111 273259/218790
112 273259/218790
113 273259/218790
114 273259/218790
115 273259/218790
116 273259/218790
117 273259/218790
118 273259/218790
119 273259/218790
120 273259/218790
121 273259/218790
122 273259/218790
123 273259/218790
124 273259/218790
125 273259/218790
126 273259/218790
127 273259/218790
128 492049/218790
0
On

Some observations that come from the spreadsheet I suggested in my comment. We have $f(0)=0, f(1)=1, f(2)=1.5$ because from $2$ we go to $1$ or $0$ with equal probability. Then $f(n)=\frac 1n\sum_{i=0}^{n-1}f(i)$ because from $n$ we go to any smaller $i$ with equal probability. $f(n)$ is constant between powers of $2$ because if $n$ is not a power of $2$ or one more we have $$f(n)=\frac 1n\sum_{i=0}^{n-1}f(i)\\ =\frac 1nf(n-1)+\frac 1n\sum_{i=0}^{n-2}f(i)\\ =\frac 1nf(n-1)+\frac {n-1}nf(n-1)\\ =f(n-1)$$ By the same argument when $n$ is a power of $2, f(n)=f(n-1)+1$ because you have $n$ in addition to the expectation of $f(n-1)$. Finally when $n$ is $2^k+1, f(n)=f(n-2)+\frac 1{n+1}$ because the extra $1$ gets added in only when the amount spent is $1$ out of the $n+1$ possibilities.

This justifies the values given in Brian Moehring's answer.