When is $\{b^2 - \{b-1\}_2\}_2=1$ with odd $b$? (The bracket-notation explained below)

For Q1:

Let $b=2^kt+1$ with odd $t$. Then equality $f(b)=1$ is equivalent to $$(2^kt+1)^2-t=2^m$$ for some $m$ (notice that $m>2k$). This is a quadratic equation in $t$. To have integer solutions, its discriminant must be a square, that is $$2^{2k+2+m}-2^{k+2}+ 1=z^2$$ for some $z>0$.

There are no solutions with even $m$ since $$(2^{k+1+m/2})^2 > 2^{2k+2+m}-2^{k+2}+ 1 > (2^{k+1+m/2}-1)^2.$$ For odd $m$, we have $$2^{k+2} - 1 = 2^{2k+2+m}-z^2 = (2^{k+1+(m-1)/2}\sqrt{2}-z)(2^{k+1+(m-1)/2}\sqrt{2}+z) > (2^{k+1+(m-1)/2}\sqrt{2}-z)2^{k+2+(m-1)/2}(\sqrt{2}+1),$$ implying that $$0 < \sqrt{2}-\frac{z}{2^{k+1+(m-1)/2}} < \frac{1}{2^{k+m-1}(\sqrt{2}+1)} < \frac{1}{(2^{k+1+(m-1)/2})^{3/2}}.$$ That is, $\frac{z}{2^{k+1+(m-1)/2}}$ represents an order $3/2$ rational approximation to $\sqrt{2}$, which suggests (although this is just a heuristics) that we should look for such fractions among convergents and semiconvergents to $\sqrt{2}$. Their denominators are given by Pell numbers (A000129) and sums of consecutive Pell numbers (A001333). The latter are odd, while it is easy to establish that the former contain just two powers of $2$ -- namely, $1$ and $2$.

PS. The known solution gives $z=11$, $k=1$, $m=3$ with the rational approximation $\frac{11}{8}$ to $\sqrt{2}$ not being a convergent or a semiconvergent. So, above is not a proof but a heuristic argument that such approximations are extremely rare, and cannot be obtained from the known sources (convergents and semiconvergents) for good rational approximations.


For Q2, if $p \equiv 1 \bmod 3$, then $p$ may be written as $p=x^2+xy+y^2$ for some $x,y\in\mathbb{Z}$. Additionally if $b^2-b+1=p^m$ for some integer $m>0$, then it may be seen that $b \not\equiv 1 \bmod p$ and hence $\{b-1\}_p=b-1$. The above gives $(x^2+xy+y^2)^m=b^2-b+1$ or $$ ((x-y\omega)(x-y\omega^2))^m=(b+\omega)(b+\omega^2) $$ where $\omega=exp(2 \pi i/3)$. For example, in your example, $$ 7=2^2+2+1 $$ and $$ 7^3=19^2-19+1 $$ as $(2-\omega)^3$ times a unit of $\mathbb{Z}[\omega]$ is equal to $19+\omega$.

Also, for Q1, a partial answer (that can probably be extended further) is:

Let $1\leq a_1 < a_2 < \dots < a_n$ and let

$$ b=1+\sum_{i=1}^n 2^{a_i}. $$

If $a_{n-1} < a_n - 2$, then $b-2^{a_n} < 2^{a_{n-1}+1} \leq 2^{a_n-2}$ and $b^2 - 2^{2a_n} < 2^{2a_n}$. Thus if we write $b^2$ as

$$ b^2 = 2^{2a_n} + \sum_{i \in A}2^i, $$

the largest $i$ in $A$ satisfies $a_n+a_{n-1}+1 \leq i < 2a_n$. However, for such $b$, we would have to have

$$ b^2 = 2^{2a_n} + \sum_{i=1}^n 2^{a_n-a_1} $$

if $\{b^2 - \{b-1\}_2\}_2 = 1$. However, $a_n-a_1 < a_n+a_{n-1}+1$. Hence $b$ with $a_{n-1} < a_n - 2$ cannot satisfy $\{b^2 - \{b-1\}_2\}_2 = 1$.

Write

$$ b = 1+\sum_{i=1}^n 2^{a_i} = 2^{a_n} + a $$ and assume that $a>0$. Then

$$ b^2 = (2^{a_n} + a)^2 \geq 2^{2a_n+1} $$

if and only if

$$ a^2 + 2^{a_n+1}a - 2^{2a_n} \geq 0. $$

As $a \geq 0$, that means that

$$ b^2 \geq 2^{2a_n+1} \Leftrightarrow a \geq 2^{a_n}(\sqrt{2}-1). $$

If $\{b^2 - \{b-1\}_2\}_2 =1$, then $$ b^2 = 2^q + \sum_{i=1}^{n}2^{a_i-a_1} $$

where $$ q=\begin{cases}2a_n+1 \mbox{ if } a \geq 2^{a_n}(\sqrt{2}-1)\\2a_n\mbox{ otherwise.}\end{cases} $$

It is the case that

$$ \{b-1\}_2 = \sum_{i=1}^n 2^{a_i-a_1} < 2^{a_n}. $$

If $a < 2^{a_n}(\sqrt{2}-1)$ then $$b^2 - 2^{2a_n} = 2^{a_n+1}a + a^2 > 2^{a_n}.$$ Therefore if $a < 2^{a_n}(\sqrt{2}-1)$, we cannot have $\{b^2 - \{b-1\}_2\}_2 =1$. Also, if $a \geq 2^{a_n-1}$, then

$$ b^2 - 2^{2a_n+1} \geq 2^{2a_n-2}. $$

$2^{2a_n-2} > 2^{a_n}$ if $a_n > 2$. Therefore if either $a < 2^{a_n}(\sqrt{2}-1)$ or ($a \geq 2^{a_n-1}$ and $a_n > 2$), we cannot have $\{b^2 - \{b-1\}_2\}_2 =1$.

Using this approach, it is possible to obtain:

Writing $b = 2^{a_n} + a$, with $0 < a < 2^{a_n}$, then $\{b^2 - \{b-1\}_2\}_2 = 1$ cannot happen when $a \in \mathbb{Z}$ and

$$ \frac{a}{2^{a_n}} \in (0,\sqrt{2}-1) \cup [\sqrt{2+\frac{1}{2^{a_n}}}-1,1). $$

The length of the interval $[2^{a_n}(\sqrt{2}-1),2^{a_n}(\sqrt{2+\frac{1}{2^{a_n}}}-1))$ converges to $\frac{1}{2\sqrt{2}}$ as $a_n \rightarrow \infty$ and hence can contain at most one integer for each $a_n \geq 1$. Hence for each $a_n \geq 1$, there is at most one integer $a$ with $0 < a < 2^{a_n}$ such that $b = 2^{a_n} + a$ could possibly satisfy $\{b^2 - \{b-1\}_2\}_2 = 1$.


The question is equivalent to finding all squares which are of the form $2^a - 2^b + 1$. This MO answer discusses the related question which squares are of the form $2^a + 2^b + 1$, and presumably the techniques in the paper (which admittedly I haven't read) should be applicable in your case as well.

EDIT: The paper referenced in the MO answer is "The equations 2N ± 2M ± 2L = z2" by László Szalay, which should answer your question as well. Unfortunately, the link there doesn't work for me, but I hope this helps.