Goal:
Given any non-zero natural number a
, find the smallest non-zero natural
number b
such that a•b
is palindromic, e.g. it reads the same forwards and backwards. Input a
through any reasonable means (STDIN, function argument, etc.), And output b
through any reasonable means (STDOUT, function return value.)
Notes:
Input will not always have a solution (multiples of 10), so you must create an error, or display -1/0
Input validation is not necessary, assume
a
is a natural number.Standard loopholes apply (Hardcoding, using a language created after this challenge)
Examples:
a=34, b=8 (272)
a=628, b=78 (48984)
a=15, b=35 (525)
a=33, b=1 (33)
a=20, (Error, -1, or 0)
a*b=c
wherea
is given andc
is a palindrome, your question asks to output 'b', the linked question asks to output 'c'. There is really very little difference... \$\endgroup\$