Conditional inside a block not working



OK, I'm officially confused here.  I am trying to write a function that
runs though a sequence of integers until an interesting value occurs, at
which point the interesting value is returned.  Here is the function I
wrote:

  (%i10) foo(bound) := block([m],
                             for m: 286 step 1 thru bound do
                               (if
is(equal(23624910,power_mod(m,3,25084897)))
                              then return(m)),
                           return(0));

When I run it with a bound below which the value I am looking for occurs
it doesn't return the correct result:

  (%i15) foo(500000000);

  (%o15)                                 0

I picked it apart experimenting with evaluating the conditional and have
narrowed the part that doesn't work as I expected to

  (%i24) block([],
             for m from 4998486 thru 4998490 do
               if is(equal(23624910, power_mod(m, 3, 25084897)))
               then return(m),
             return(0));
  (%o24)                                 0

The loop is only 3 deep and the answer, 4998488, is bracketed.  I
expected to see 4998488 in (%o24).

I also tested the expression in the if part and it seems to work:

  (%i25) is(equal(23624910, power_mod(4998488, 3, 25084897)));
  (%o25)                               true
  (%i26) ev(is(equal(23624910, power_mod(m, 3, 25084897))),m:4998488);
  (%o26)                               true
  (%i27)

Obviously my thinking has gone off the tracks somewhere; can someone
show me where?

Thanks,

 -- Bill Wood