Those who know binary, and those who don't.
The number 2015 is a palindrome in binary (11111011111 to be exact) Given a year (in base 10 notation) calculate how many more years it will be until the next year that is a binary palindrome. For example, if you are given the year 1881 (palindrome in base 10! :-), the function should output 30, as the next year that is a binary palindrome is 1911. You can assume all years are positive integers.
Good luck!!kcul dooG
Code can be made even smaller by replacing 'ans' in line 3 directly with line 2.
146 Solvers
312 Solvers
Rounding off numbers to n decimals
282 Solvers
Integer Sequence - II : New Fibonacci
141 Solvers
111 Solvers