Ask Your Question
1

multiplicative functions for factored integers

asked 2021-11-18 17:50:14 +0100

Max Alekseyev gravatar image

updated 2021-11-18 18:07:12 +0100

Since integer factorization is rather expensive computationally, its result sometimes represent quite a valuable piece of information that we do not want to recompute. Sage provides Factorization object for dealing factored integer (and more generally rational) numbers, and even supports multiplication / division of such integers - like factor(1000) / factor(10).

However, while it is easy to compute multiplicative functions for a given Factorization object, such standard multiplicative functions as number_of_divisors(), sigma(), divisors(), etc. are missing for Factorization objects. Also, factor() function should also trivially work for them, returning just the given Factorization object (currently we get a weird error like TypeError: unable to factor 2 * 5).

Do I miss something here?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2021-11-19 03:13:56 +0100

Max Alekseyev gravatar image
edit flag offensive delete link more
0

answered 2021-11-18 18:34:41 +0100

slelievre gravatar image

Great idea. Please open a ticket for that if there is not already one.

One thing to decide is, for partial factorisations such as:

sage: f = Factorization([(10, 1), (20, 1)])
sage: f
10 * 20

whether f.factor() and factor(f) should factor them further.

Somewhat related:

edit flag offensive delete link more

Comments

Is there a way to quickly recognize whether a given factorization is partial or complete?

Max Alekseyev gravatar imageMax Alekseyev ( 2021-11-18 18:42:17 +0100 )edit

I would run is_prime on each factor.

The factor method for factorisations could offer an optional argument check=True that could be set to False if one knows the factors to be prime.

slelievre gravatar imageslelievre ( 2021-11-18 19:16:56 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-11-18 17:50:14 +0100

Seen: 278 times

Last updated: Nov 19 '21