| Deutsch English Français Italiano |
|
<v6pjmj$2kqvg$3@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro <ldo@nz.invalid> Newsgroups: comp.lang.python Subject: Re: Relatively prime integers in NumPy Date: Thu, 11 Jul 2024 21:43:47 -0000 (UTC) Organization: A noiseless patient Spider Lines: 11 Message-ID: <v6pjmj$2kqvg$3@dont-email.me> References: <SA0PR09MB6363F3E6B493202E73869DF4DBDA2@SA0PR09MB6363.namprd09.prod.outlook.com> <00e801dad3bf$473daed0$d5b90c70$@gmail.com> <mailman.29.1720722147.2981.python-list@python.org> <87wmlrn5dr.fsf@nightsong.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 11 Jul 2024 23:43:47 +0200 (CEST) Injection-Info: dont-email.me; posting-host="ead23d2d8cf5f779654345cfcdaaae64"; logging-data="2780144"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX195C4kJAiltkdVwk6EK7hwC" User-Agent: Pan/0.158 (Avdiivka; ) Cancel-Lock: sha1:fxOn0I3YPqkzXcxZFTGy22V1s2w= Bytes: 1713 On Thu, 11 Jul 2024 11:35:44 -0700, Paul Rubin wrote: > Two numbers a and b are coprime if math.gcd(a,b) == 1, I am pretty sure. > That is true by definition(?) when a and b are both > 0. Experiment > indicates it seems to work even when one or both of a and b are > negative, but I don't have a proof and haven't examined the > implementation. I don't know how gcd is mathematically defined in that > situation. You can derive the answer quite trivially by observing that negative numbers are smaller (less than, not greater than) positive numbers.