Given a positive integer
N, output the smallest positive integer such that this number is a palindrome (i.e. is its own reverse) and is divisible by
The palindrome (i.e. the output) must not need a leading zero to be a palindrome, e.g.
080 is not the valid answer for
The input will never be a multiple of 10, because of the previous reason.
Your program may take as much time as necessary, even if in practice it would be way too long to output the answer.
Inputs and outputs
- You may take the input through
STDIN, as a function argument, or anything similar.
- You may print the output to
STDOUT, return it from a function, or anything similar.
- Inputs and outputs must be in the decimal base.
N Output 1 1 2 2 16 272 17 272 42 252 111 111 302 87278 1234 28382
This is code-golf, so the shortest answer in bytes wins.