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

More By Author:

Check out these other kata created by rubs33

Stats:

CreatedNov 6, 2022
Warriors Trained16
Total Skips0
Total Code Submissions20
Total Times Completed5
Groovy Completions1
JavaScript Completions5
PHP Completions1
Total Stars2
% of votes with a positive feedback rating100% of 3
Total "Very Satisfied" Votes3
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes0
Total Rank Assessments3
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • rubs33 Avatar
Ad