interesting problem. This is my finding for the anwer
Let X=XmXm-1Xm-2.....X1X0 be the number in base b. (where 0<=Xi<=b-1 because X is written in base b)
We will devise a test for disibility of X by n.
X can be rewritten as :
X = X0 + X1xb + X2xb^2 +X3xb^3+ .....+Xmxb^m (1)
Let us consider n
n is a divisor of b^2+1, hence b^2+1 = k x n (k is integer)
and b^2 = k x n -1
Replace b^2 in (1) by k x n -1, we obtain
X = X0 + X1xb + X2 x (k x n -1) + X3 x b x(k x n -1) +...+Xm x b^(m-2) x (k x n -1)
X = k x n x[X2 + X3 x b+....+Xm xb^(m-2)] +
X0 + X1xb - X2 - X3xb -.......- Xmxb^(m-2)
enlighted?
to see if X is divisible by n we only need to check if [X0 + X1xb - X2 - X3xb-......- Xmxb^(m-2)] is divisible by n
X0 + X1xb - X2- X3xb -.......- Xmxb^(m-2) = - [ (X2-X0)+ (X3-X1)xb+.....Xmxb^(m-2)]
[ (X2-X0)+ (X3-X1)xb+.....Xmxb^(m-2)] in base b is written as XmXm-1.......X4(X3-X1)(X2-X0)
Now we have the same poblem with the first one but with different number. That is devise a test to check if XmXm-1...X4(X3-X1)(X2-X0) is divisible by n, where n is a divisor of b^2+1
By the same token, it leads us to another analogous problem:
Devise a test to check if XmXm-1...X6[X5-(X3-X1)][X4-(X2-X0)] is divisible by n
and so on ....
Finally we only have to check if the number [Xm-(Xm-2-(Xm-4........)))][Xm-1-(Xm-3-(Xm-5-........)))] is divisible by n
or check if
[Xm-Xm-2+Xm-4-Xm-6........][Xm-1-Xm-3+Xm-5-Xm-7......] is divisible by n
or check if
[Xm- Xm-2 + Xm-4 - Xm-6 +........]x b +[Xm-1 - Xm-3 + Xm-5 - Xm-7+......] is divisible by n, which is easily to check
I hope u understand what i wrote

because i don't know how to describe mathematical notation with this editor