Determine the minimum value of a positive integer N such that:
o N has the form: 97.......97, and:
o N is divisible by 99
(In reply to
re(3): solution by H M)
You have indeed uncovered a bug in the program. After testing 97997, the next number tested was 971097, which indeed skips over ever even testing 970497 for divisibility by 99. This results from incrementing the latter part of the number from 997 to 1097, and increasing the front part to 970000 to accommodate the now 4-digit end part.
I was trying to avoid the overhead of character formats, but introduced this bug in the process. Accounting for leading zeros in the mid part is a problem also. Just forming the numbers to be tested is more complex than it would seem.
|
Posted by Charlie
on 2021-12-12 18:07:46 |