Integer solutions to linear equation?
Grant Edwards
grant at nowhere.
Tue Apr 18 12:57:24 EDT 2000
In article <m33dojcs60.fsf at atrus.jesus.cam.ac.uk>, Michael Hudson wrote:
>> 64x = 41y + 1
>>
>> Where x and y are both integers. After scratching our heads
>> for a while, we used the brute force approach:
>>
>> for x in range(1,100):
>> y = ((64*x)-1)/41
>> if 64*x == 41*y+1:
>> print (x,y)
>Use Euclid's algorithm; here's some code that does that:
You know, that looks vaguely familiar. I took numerical
analysis 20 years ago and haven't used it since. I'll have to
do some reading on this (I've got a 20 hour plane trip coming
up soon, so I should have plenty of time).
--
Grant Edwards grante Yow! I request a weekend
at in Havana with Phil
visi.com Silvers!
More information about the Python-list
mailing list