Draft
Binary Palindrome
1 of 5rubs33
Description:
Create a function binaryPalindrome
that receives an integer number N
(where N
> 0) and returns the N-th binary palindrome (starting from 1).
A binary palindrome is a decimal number which its binary representation is a palindrome (the binary digits in the reverse order are the same of the original binary digits).
Examples of the first 10 decimal numbers that are binary palindrome numbers:
- 1st = 1 (binary = 1)
- 2nd = 3 (binary = 11)
- 3rd = 5 (binary = 101)
- 4th = 7 (binary = 111)
- 5th = 9 (binary = 1001)
- 6th = 15 (binary = 1111)
- 7th = 17 (binary = 10001)
- 8th = 21 (binary = 10101)
- 9th = 27 (binary = 11011)
- 10th = 31 (binary = 11111)
Your function should be able to handle values from 1 to 1000000.
Binary
Logic
Similar Kata:
Stats:
Created | Nov 6, 2022 |
Warriors Trained | 16 |
Total Skips | 0 |
Total Code Submissions | 20 |
Total Times Completed | 5 |
Groovy Completions | 1 |
JavaScript Completions | 5 |
PHP Completions | 1 |
Total Stars | 2 |
% of votes with a positive feedback rating | 100% of 3 |
Total "Very Satisfied" Votes | 3 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 3 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |