Integer math question
Samuel Walters
swalters_usenet at yahoo.com
Mon Jan 5 12:55:33 EST 2004
|Thus Spake Sean Ross On the now historical date of Sat, 03 Jan 2004
16:31:17 -0500|
> I think you're supposed to do something like this a = bq + r, 0<= r <
> |b|
It is, indeed, 0 <= r < abs(b)
"If a and b are integers such that b != 0, then there exist unique
integers r and q such that a = q*b + r and 0 <= r < abs(b)"
For non-mathematical spectators, the divmod() function is defined so that
q, r = divmod(a, b) by the definition above.
Sam Walters
--
Never forget the halloween documents.
http://www.opensource.org/halloween/
""" Where will Microsoft try to drag you today?
Do you really want to go there?"""
More information about the Python-list
mailing list