http://serjudging.vanb.org/wp-content/uploads/basesums.pdf

Given three values n, a, and b, find the smallest m>n such that the sum of the digits of m in

base a is the same as the sum of digits of m in base b.

Each input will consist of a single test case. Note that your program may be run multiple times

on different inputs. There will be a single line of input, with three integers, n (0≤n≤1016), a and

b (2≤a < b≤36), all of which will be in base 10.

I couldn’t find any solutions on the judging blog for the competition (http://serjudging.vanb.org/?p=1025), although it does have the test data.