Retina, 27 bytes
+`(1+)\1
$1_
^(1|-1_)(__)*$
Takes input in unary, which is fairly standard for Retina. The first two lines do partial unary to binary conversion based on the first two lines of code from the Tutorial entry (any extraneous 1
s will cause the match to fail anyway), while the last line checks for a power of four or a negative odd power of two.
+`(1+)\1\1\1
$1_
^(-1)?1_*$
This time I do partial unary to base four conversion. Powers of four end up as ^1_*$
while negative odd powers of two end up as ^-11_*$
.
+`\b(1111)*$
$#1$*
^(-1)?1$
This time I just keep dividing by four as much as I can and check for 1
or -11
at the end.
+`\b(1+)\1\1\1$
$1
^(-1)?1$
Another way of dividing by four. And still annoyingly 27 bytes...