Sujet : RE: Relatively prime integers in NumPy
De : <avi.e.gross (at) *nospam* gmail.com>
Groupes : comp.lang.pythonDate : 11. Jul 2024, 20:22:24
Autres entêtes
Message-ID : <mailman.29.1720722147.2981.python-list@python.org>
References : 1 2
User-Agent : Microsoft Outlook 16.0
Дмитрий,
You may think you explained what you wanted but I do not see what result you
expect from your examples.
Your request is a bit too esoteric to be a great candidate for being built
into a module like numpy for general purpose se but I can imagine it could
be available in modules build on top of numpy.
Is there a reason you cannot solve this mostly outside numpy?
It looks like you could use numpy to select the numbers you want to compare,
then call one of many methods you can easily search for to see how to use
python to make some list or other data structure for divisors of each number
involved and then use standard methods to compare the lists and exact common
divisors. If needed, you could then put the results back into your original
data structure using numpy albeit the number of matches can vary.
Maybe a better explanation is needed as I cannot see what your latter words
about -1 and 1 are about. Perhaps someone else knows.
-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=
gmail.com@python.org> On
Behalf Of Popov, Dmitry Yu via Python-list
Sent: Monday, July 8, 2024 3:10 PM
To: Popov, Dmitry Yu via Python-list <
python-list@python.org>
Subject: Relatively prime integers in NumPy
Dear Sirs.
Does NumPy provide a simple mechanism to identify relatively prime integers,
i.e. integers which don't have a common factor other than +1 or -1? For
example, in case of this array:
[[1,5,8],
[2,4,8],
[3,3,9]]
I can imagine a function which would return array of common factors along
axis 0: [1,2,3]. Those triples of numbers along axis 1 with the factor of1
or -1 would be relatively prime integers.
Regards,
Dmitry Popov
Argonne, IL
USA
-- https://mail.python.org/mailman/listinfo/python-list