Imagine a method of writing integers which is similar to balanced ternary, except as you write more digits, their value increases by a factor of 2, not 3. For the remainder of the post, I will call this system "balanced binary". For example: (with T representing -1)
1T11 $= 1*2^0 + 1*2^1 - 1*2^2 + 1*2^3 = 7$
10T $= -1*2^0 + 0*2^1 + 1*2^2 = 3$
Obviously, there is more than one way to represent each integer in this system, as an n-digit number can range from $-2^{n+1}+1$ to $2^{n+1}-1$, which contains roughly $2^{n+2}$ numbers, and the n-digit balanced binary string has n ternary digits, which can represent $3^{n}$ numbers, clearly more as n grows.
If given a string in balanced binary, you can apply 2 transformations to the string which do not change its value. These are:
1T <=> 01
T1 <=> 0T
For example:
1T11 $= 7$
10T1 $= 1*2^0 - 1*2^1 +0*2^2 + 1*2^3 = 7$
These represent the fact that $2-1=0+1$, and $1-2=0-1$, respectively.
By applying these transformations to eliminate all T's, all positive numbers written in balanced binary can be converted to their standard binary representations. For negative numbers, the same can be done by eliminating all 1's, then swapping every T with a 1 and adding a negative sign.
What I would like to know is: how can I compute a function which, given an integer and a string length, outputs the number of ways the integer can be written in a balanced binary string of the given length, and, optionally, a list of the representations.

Let $n$ be the given length of the balanced binary representation.
Let $x$ be an integer, such that $0\le x \le 2^n-1$.
Let $b(0),b(1),\dots,b(n-1)$ be the binary digits $x$, so each $b(i)\in \{0,1\}$, and $$x=2^{n-1}b({n-1}) + \dots + 2^0b(0).$$
In words, we find all ways to select a set of disjoint contiguous subsequences of the list $[b(n-1),\dots,b(0)]$, where each subsequence begins with a zero and ends with a one.
Each noncrossing 0-1 matching determines a representation of $x$ of length $n$ in balanced binary, as follows. For $i\in \{1,\dots,k\}$, and each interval of digits of the form $$ [b(m_{2i-1}),b(m_{2i-1}-1),\dots,b(m_{2i})], \qquad b(m_{2i-1})=0,\quad b(m_{2i})=1, $$ we will modify the digits in this interval as follows. We make replacements of the form
01 -> 1TandT1 -> 0Tuntil the only remaining1in this block of digits occurs on the left. What remains will be a block starting with $1$, where the rest is made of0andT, such that the last digit isT.For example, with $n=5$ and $x=00101_2=5$, here are the noncrossing 0-1 matchings, and the resulting balanced binary representations.
001010011T01T0101T1T010TT1TT011TT1T1T0TTProof of claim: Given a balanced binary representation $B$ of $x$, where the length of $B$ is $n$, we find the corresponding noncrossing 0-1 matching as follows.
T; its location is the smallest entry in the non-crossing matching.1which is to the left of theTin the previous step; its location is the second smallest entry in the noncrossing matching.T, the leftmost digit is a1, and all digits between are0orT, until allTs have been captured in some interval.This proves that every string is generated. Proof of uniqueness is not too bad, and left to the reader. $\square$
Using the claim, you can imagine a simple backtracking program which enumerates all non-crossing 0-1 matchings of $x$.