Digit by digit square root algorithm for negabinary (base -2)

409 Views Asked by At

How could one calculate the square root of a negabinary number digit by digit? I know how to calculate the square root of binary numbers by hand, but I'm unsure how to expand this to negabinary.

For example: How to calculate the square root of $ 1101001_{-2} $ which is $25_{10}$?

Using the algorithm, the answer should either be $101_{-2}=5_{10}$ or $1111_{-2}=-5_{10}$ (whichever is easier to calculate using the algorithm).

Note: Given the following $n$-bit negabinary number $x_{n-1}x_{n-2}...x_1x_0$ where $x_i \in \text{{0, 1}}$.

A negabinary number's decimal value is equal to $\sum\limits_{i=0}^n x_i(-2)^i$