Solved

# Formula to identify special binary numbers

Posted on 2013-02-06

I need a formula that will tell me if a number, when converted to binary, has 1's with 0's between them.

Example -

00 = 00000000

01 = 00000001

02 = 00000010

03 = 00000011

04 = 00000100

05 = 00000101 *

06 = 00000110

07 = 00000111

08 = 00001000

09 = 00001001 *

10 = 00001010 *

11 = 00001011 *

12 = 00001100

13 = 00001101 *

in the above binary representations, 5, 9, 10, 11, and 13 have 1's with one or more 0's between them so I would want a formula that returns true -

Example -

fncSpecialBinary(4) returns false

fncSpecialBinary(5) returns true

Thanks,

Kevin.