Given, for example,
N = 31,415,926,535
n = 592
and notice that n is a decimal digit substring of N.
Can we confirm the presence n's digits in N by arithmetic?
Some context: The problem is testing a function that returns the bits from i to j of a 32-bit object. It does so by bit manipulation. Using automated arithmetic to check that the returned segment of bits is correct makes it feasible to test all 32-bit integers and all i,j combinations. The base (decimal vs. binary) is irrelevant in the solution.
In your example the $2$ is in the ten thousands place. We can check if $N$ has $592$ in the ten thousands place by taking $\left\lfloor \frac N{10^4}\right\rfloor \bmod 1000$ and asking if it is $592$ The division and floor strip off the lower four digits and the $\bmod 1000$ strips off the higher digits.
To generalize this note that $n$ has $\lfloor \log_{10}n\rfloor +1=k$ digits and $N$ has $\lfloor \log_{10}N\rfloor +1=K$ digits, so the ones digit of $n$ cannot be any higher than the $10^{K-k}$ digit of $N$ and still fit. We loop over $i=0$ to $K-k$ and ask if $\left\lfloor \frac N{10^i}\right\rfloor \bmod 10^{k-1}=n$. If we find one, then $n$ is a substring of $N$