Determine the respective smallest and largest 3digit palindromes in base 2017 each of which is divisible by 7.
*** Leading zeros in any of the palindromes is not allowed.
ABA in base 2017 is (2017^2 + 1) * A + 2017 * B.
2017 is 1 mod 7; we need the total to be zero mod 0.
For the largest we wand A to be as large as possible: 2016, which is already zero mod 7; we might as well make B 2016 also. The digits are all 2016.
For the smallest, remember that (2017^2 + 1) is 2 mod 7. If A is 1, to make ABA small, B must be 5 mod 7, or just plain 5. We have 151. In decimal that's 582625.

Posted by Charlie
on 20160411 10:16:10 