It appears empirically, that if B is any power of 2 exceeding 2^24, then there exist A such that the continued fraction for A/B has only 1s and 2s as partial quotients. The unconvincing speculation that this keeps on working would be based on the empirical fact that the number of A's seems to be noisily increasing as a function of n for B=2^n from n=24 (no solutions) up to n=31 (21 solutions). However, this is rudely interrupted at n=32 (only 5 solutions) and n=33 (zero solutions!!) ----------- Now to explain my "faster than brute force" method for trying to find solutions A (given B) such that A/B has only 1s and 2s in its continued fraction: You initially make a table of all continued fractions [1,2,2,1,1...] of some maximum length L containing only 1s and 2s, and view them as 2x2 matrices. (and we could employ other measures than "maximum length"...) Now we do a "meet in the middle attack." That is, we are going to consider length-2L continued fractions made by gluing two halves from our table together. This multiplies their 2x2 matrices. One of the matrix entries has to equal B to yield a solution. The crude way would simply consider all possible matrix-pairs in time quadratic in the size of our table. The better idea is to consider all matrix-pairs from our table, only considering the ones which can yield our desired B (and saving immense time by not considering other matrix-pairs which have no chance to work). This can be done using "computational geometry." Namely, given matrix1, the suitable matrix2 such that matrix1*matrix2 has an entry B, are those such that a certain 2-vector dot product equals B. This corresponds to those such that the two entries X,Y in that dot product, lie on a certain line. So if we preprocess our table -- each table element viewed as an X,Y two-tuple -- to support "fast line queries" using known data structures for computational geometry ("simplex range queries" will do) we can accomplish this a lot faster than brute force, effectively reducing "quadratic" to a smaller power than 2. An interesting meld of computational geometry and number theory, but I have not implemented & tested this.