Skip to main content
7 events
when toggle format what by license comment
Apr 11 at 18:14 comment added Arbuja Sorry for the confusion.
Apr 11 at 18:14 comment added Arbuja Thanks. You were originally correct. $1/2^{n+1}$ should be $1/2^{n}$ and $1/2^{n+2}$ should be $1/2^{n+1}$. You don't have to make any changes.
Apr 11 at 18:14 comment added march @Arbuja. While we don't run into recursion depth issues, it will take a long time to compute this for large $n$. For instance, a[10] takes 0.7 seconds, a[11] takes 2.5 seconds, and a[12] takes 7.3 seconds (starting from scratch anyway). I think the computation time rises exponentially: roughly, computing the $n$'th steps costs as much (or twice-ish as much) time as all of the $m<n-1$ steps combined.
Apr 11 at 18:12 vote accept Arbuja
Apr 11 at 18:05 comment added march @Arbuja I had an error in the post; I've fixed it now (I think: you should verify). I have chosen the powers of 2 so that they match your results at the end of your OP. To change this to match the algorithm described in the opening paragraph of your post, change the powers of 2: $1/2^{n+1}$ should be replaced by $1/2^n$ and $1/2^{n+2}$ should be replaced by $1/2^{n+1}$.
Apr 11 at 18:04 history edited march CC BY-SA 4.0
added 16 characters in body
Apr 11 at 17:39 history answered march CC BY-SA 4.0