For positive integer $D$, the Diophantine equation $$x^2+D=2^k$$ has been shown to have at most $2$ solutions, except in the case $D=7$, when it has the five solutions $x=1,3,5,11,181$. This was first conjectured by Ramanujan.
Obviously, when $D$ is zero, there are infinitely many solutions. I am interested in the case with opposite signs; that is, solutions in positive $D,x$ of the equation $$x^2-D=2^k$$ Note that if $D=2m$ is even, then (except for possibly at $k=0,1$) we can reduce to an integer solution $(\frac{x}{2},\frac{D}4,2^{k-2})$, so it generally suffices to consider the case of odd $D$. However, note that this means $4D$ may have one more solution than $D$.
It easy to see that when $D$ is of the form $(2^n-1)^2-2^{n+2}$, the equation has at least the four solutions $x=2^n-3, 2^n-1, 2^n+1, 3\cdot 2^n-1$. (In fact, the first four solutions for the Ramanujan-Nagell equation arise from taking $n=2$ here, which yields $D=-7$.) Such $D$ are given by the sequence $17,161,833,3713,\ldots$ (not in OEIS).
After conducting a computer search, it appears that the only odd $D\le1000000$ for which this equation has at least four solutions are of the above form, and that none of them have five solutions. However, when multiplying by $4$ there is one case that introduces an additional solution: $D=17\cdot4^3=1088$ offers the additional solution $x=33$, so it and all further multiplications by $4$ thereof have five solutions.
The $D$ for which there appear to be at least $3$ solutions begin $17,68,105,161,272,420,497,\ldots$; the odd such $D$ begin $17, 105, 161, 497, 713,\ldots$. Neither sequence is in the OEIS, nor are the corresponding sequences for at least $4$ solutions.
This equation has been investigated previously, and seems rather difficult; there is a 1983 paper by Nicholas Tzanakis which addresses the case $D\le 100$, and specifically the nontrivial cases $D= 17, 41, 73, 89, 97$. So I am not particularly hopeful for a general-purpose resolution of this equation, but I wonder if some weaker facts about it have been shown:
Is it known whether there are finitely many solutions for fixed $D$?
If so, is there a specific upper bound (perhaps just for odd $D$)? How close to $5$ is that bound?
Are there values of $D$ with more than five solutions, odd values of $D$ with more than four solutions, or values of $D$ with five solutions not of the form $4^{n+3}\cdot 17$?