Max Alekseyev on Thu, 14 Sep 2017 22:31:18 +0200

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

 Re: eulerphi(0)

Thanks to everyone for the explanation -- the value 2 starts making sense now.
What bothers me though is that different (equivalent on positive arguments) definitions of eulerphi() result in different values for eulerphi(0).
I understand that PARI just stick to one particular definition and extents the domain of eulerphi() based on this definition.
Given the number of other popular definitions, would it be more safe to not do so, and instead generate an error outside of the positive integers domain?
Regards,
Max

On Thu, Sep 14, 2017 at 4:17 PM, Karim Belabas wrote:
* Max Alekseyev [2017-09-14 21:47]:
> Is there any particular reason behind eulerphi(0) = 2 ?
>
> ? eulerphi(0)
> %1 = 2
>
> I'd rather expect eulerphi(0) to result in an error.
> Zero value would also make more sense, since there are no positive integers
> <=0 (even if we do not care about co-primality).

%%%%%%%%%%%%%%%%%%

(22:15) gp > ??eulerphi
eulerphi(x):

Euler's phi (totient) function of the integer |x|, in other words |(Z/xZ)^*|.

? eulerphi(40)
%1 = 16

According to this definition we let phi(0) := 2, since Z^* = {-1,1};   this
is consistent  with  znstar(0):  we have znstar(n).no = eulerphi(n) for all n
in Z.

%%%%%%%%%%%%%%%%%%

Cheers,

K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux         Fax: (+33) (0)5 40 00 21 23
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~kbelabas/
F-33405
Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
`

• Follow-Ups:
• References: