
November 9th, 2012, 07:55 PM
|
|
Registered User
|
|
Join Date: Nov 2012
Location: Texas
Posts: 24
Time spent in forums: 5 h 54 m 45 sec
Reputation Power: 0
|
|
Quote: | Originally Posted by b49P23TIvg The division part of your program might be faster using divmod. Then again, you might end up storing a bunch of really long unused quotients. Don't know.
Code:
>>> help(divmod)
Help on built-in function divmod in module __builtin__:
divmod(...)
divmod(x, y) -> (quotient, remainder)
Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.
|
Thanks for the divmod tip, but in this case it won't help, as I don't want to i/p unless p is a factor of i, in which case there won't be a remainder.
|