Charles Greathouse on Fri, 20 Feb 2015 06:18:59 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: moebius function

This is a problem that Windows has when doing moderately-large factorizations (MPQS). It's related to renaming temporary files, and it's come up a number of times before -- the maintainers keep thinking they've fixed it, but it seems that Windows is doing something bad or we just don't understand it as well as we think we do.

You can use write("file.txt", v) to write a vector (or list, etc.) to a file.

Charles Greathouse
Case Western Reserve University

On Thu, Feb 19, 2015 at 10:21 PM, Chris De Corte <> wrote:

I am doing tests on the moebius.
It went well for a few days until tonight when It gave an error.
A printscreen is attached.
What is the problem?
Is the m on the screen reliable?

By the way: when I want to make a list. how do I send my output to a file in pari/gp?

Thanks for your answer,

From: Karim Belabas <>
To: Chris De Corte <>
Sent: Tuesday, February 17, 2015 8:42 AM
Subject: Re: moebius function

* Chris De Corte [2015-02-17 04:34]:
> Your moebius function seems to do calculations for very high
> figures.But your prime function seems to only go for low figures.

prime(n) uses a naive O~(n) algorithm (see ??prime), whereas moebius() calls
factor / factorint which use subexponential algorithms in exp O~(log n)^(1/2).

> Is your moebius then reliable?

It is to the extent factor() is: there is a remote possibility  that a
composite > 2^64 is incorrectly considered as prime (??factor).
[No example is known at present]


  default(factor_proven, 1)

to get rid of this possibility (or set factor_proven = 1 in your gprc).
This will slow down a little the arithmetic kernel, but it may be
tolerable, or even negligible, in your application ( at worst
O(log n)^logloglog(n) extra cost when needing to factor the integer n )

In any case, moebius() will remain much faster than prime() :-)


Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux        Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation
F-33405 Talence (France) [PARI/GP]