+ 6

Double-base palindromic numbers?

If integer number palindrome in the decimal base it looks like: ... Decimal: 585; Decimal: 4554; Decimal: 676... or for binary: ... Binary: 1001; Binary: 11111; Binary: 1011101... If integer number palindromic in two basis it looks like: ... Decimal: 717; Binary: 1011001101; Decimal: 7447; Binary: 1110100010111; Decimal: 9009; Binary: 10001100110001... With help of this code you can search for lot of palindromic numbers. I successfully tested id for first numbers below 10,000,000. https://code.sololearn.com/c25iD0kFCWjS/#cpp

15th Feb 2018, 2:40 PM
Dmytro Kovryzhenko
Dmytro  Kovryzhenko - avatar
5 Answers
+ 4
Hi Dmytro ! Playing with the good idea you shared here, I came to a funny result with the code I made : I'm afraid I must share with you that the most palindromic (multi-basely speaking) is none other than : 4369 ! Explanation is on top of the code: https://code.sololearn.com/cglfB2nHnE2i/#py
23rd Mar 2018, 2:41 PM
CĂ©pagrave
CĂ©pagrave - avatar
+ 4
@Cestpasgrave It is so great that you change task and founded the MOST palindromic number (if I understand right). I will try to repeat after you in the c++ version.
23rd Mar 2018, 2:47 PM
Dmytro Kovryzhenko
Dmytro  Kovryzhenko - avatar
+ 2
nice idea
15th Feb 2018, 2:42 PM
Alex
Alex - avatar
+ 2
A good practice would be to optimize the algorithm to get faster results.
15th Feb 2018, 3:34 PM
Alex
Alex - avatar
+ 1
I finally get to do it, like a year late, good idea for practice :D Can't beat CĂ©pagrave's 64 bases code still, this one checks for possible Palindrome from base 2 to 36 on a given number, or range. https://code.sololearn.com/ck4ky39xQ4qP/?ref=app
27th Apr 2019, 4:05 PM
Ipang