+ 8
[Challenge 4] Program to check given number is fibbinary or not.?
Integers whose binary representation contains no consecutive ones is a fibbinary number. Write a program to check given number is fibbinary or not in complexity O(1). Input : 9 Output : Fibbinary Input : 6 Output : No https://code.sololearn.com/cmZ7VoSt08jm/?ref=app
5 Answers
+ 7
https://code.sololearn.com/chr32j913VDV/?ref=app
+ 2
print(["","not "][not (x&(x>>1))]+"fibbinary") because x&(x>>1) equals zero if and only if x includes no condecutives ones
+ 1
Nice challenge!