Rather than draw circles, here is a similar example using numbers. The problem is to search pairs of numbers (m,n) so that the digits of m+n are all the same (like 111, 22, 3333, and so on). Below, parameter t in the function limits the search to range(t) for each of m, n.

1 2 3 4 5 6 7 8 9 10 | ```
def samedigits(k):
s = str(k)
return s == len(s)*s[0]
def search(t):
C = [(m,n) for m in range(t)
for n in range(t)
if samedigits(m+n) ]
return C
print search(12)
``` |

The only clever idea of the program is the test
of having all the digits be the same, as encoded
in samedigits(k). This is similar to the idea of
testing whether or not a string V is all uppercase
by `V==V.upper()`

: one side of the
== operator has the value to be tested, the other
side has the regularized (all uppercase, all same
digits) value.

The program above takes about 900 steps to run, even
with the range limit of 12!
So many steps are needed to try all possible combinations
from 0-11 for each of m and n, then running the
samedigits evaluation on each combination. This seems
quite a lot of work to solve a simple problem; computer
scientists might call this *exhaustive search* because
it tries all combinations without any cleverness that
might skip over some of the combinations and avoid extra
work. Clearly, we should try to do better, but sometimes
exhaustive search cannot be avoided.