11
Write a program that reads from stdin two integers, each newline terminated, hereafter called "number" and "radix", and:
- Prints any fixed message you want if the number is a palindrome in that radix (e.g.
true
,t
,1
) - Prints any different fixed message you want if the number is not a palindrome in that radix (e.g.
false
,f
,0
, etc.) - These messages must be the same per each run, but there are no rules about what they must be (whatever's best for golfing).
- You may assume the input is valid, two positive integers. "number" will not exceed
2147483647
, "radix" will not exceed32767
. - You may not use external resources, but you may use any math function included by default in your language.
Note: a radix is just the base of the number.
Sample runs:
16
10
false
16
3
true
16
20
true
121
10
true
5
5
false
12346
12345
true
16781313
64
true
16781313
16
true
Can one of the fixed messages be the empty string (assuming that the other is a non-empty string)? – Toby Speight – 2018-08-08T09:36:17.673
Note: a radix is just the base of the number. – None – 2014-02-28T21:32:24.447
Looks good now. You may want to ban external resources though. – None – 2014-02-28T21:35:01.817
@user2509848 hmmm, for instance? – durron597 – 2014-02-28T21:38:39.177
If a person can find a calculator on the web that converts numbers between bases, it will almost certainly be used. We have been having a rash of trolly answers lately. – None – 2014-02-28T21:40:06.990