All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Positively Palindromic (Posted on 2014-04-06) Difficulty: 3 of 5
Determine the smallest positive integer each of whose base 6, base 8 and base 9 representations is a palindrome.

*** Any solution must contain more than one digit in any given base. So, trivial solutions like (2)base 8 or, (7)base 9 are not allowed.

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution solution Comment 2 of 2 |

154  where the base representations are:

        414 232 181

 

DECLARE FUNCTION basen$ (x!, n!)
DECLARE FUNCTION isPalin! (s$)
FOR n = 10 TO 999999
 IF isPalin(basen$(n, 6)) AND isPalin(basen$(n, 8)) AND isPalin(basen$(n, 9)) THEN
   PRINT n, basen$(n, 6); " "; basen$(n, 8); " "; basen$(n, 9)
 END IF
NEXT

FUNCTION basen$ (x, n)
  s$ = ""
  x2 = x
  WHILE x2 > 0
    d = x2 MOD n: x2 = x2 \ n
  
    s$ = LTRIM$(MID$("0123456789abcdef", d + 1, 1)) + s$
  WEND
  basen$ = s$
END FUNCTION

FUNCTION isPalin (s$)
 good = 1

 FOR i = 1 TO LEN(s$) / 2
   IF MID$(s$, i, 1) <> MID$(s$, LEN(s$) + 1 - i, 1) THEN good = 0: EXIT FOR
 NEXT
 isPalin = good
END FUNCTION

 


  Posted by Charlie on 2014-04-06 20:50:04
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information