OFFSET
1,2
COMMENTS
a(n) is the exponent of the multiplicative group of Gaussian integers modulo n, i.e., (Z[i]/nZ[i])* = {a + b*i: a, b in Z/nZ and gcd(a^2 + b^2, n) = 1}. The number of elements in (Z[i]/nZ[i])* is A079458(n).
For n > 2, a(n) is divisible by 4. - Jianing Song, Aug 29 2018
From Jianing Song, Sep 23 2018: (Start)
Equivalent of psi (A002322) in the ring of Gaussian integers.
a(n) is the smallest positive e such that for any Gaussian integer z coprime to n we have z^e == 1 (mod n).
LINKS
Jianing Song, Table of n, a(n) for n = 1..10000
Wikipedia, Gaussian integer
Wikipedia, Torsion group
FORMULA
a(2^e) = 2^e if e <= 2 and 2^(e-1) if e >= 3, a(p^e) = (p - 1)*p^(e-1) if p == 1 (mod 4) and (p^2 - 1)*p^(e-1) if p == 3 (mod 4). If gcd(m, n) = 1 then a(mn) = lcm(a(m), a(n)). - Jianing Song, Aug 29 2018 [See the group structure of (Z[i]/(pi^e)Z[i])* in A316506, where pi is a prime element in Z[i]. - Jianing Song, Oct 03 2022]
EXAMPLE
Let G = (Z[i]/4Z[i])* = {i, 3i, 1, 1 + 2i, 2 + i, 2 + 3i, 3, 3 + 2i}. The possibilities for the exponent of G are 8, 4, 2 and 1. G^4 = {x^4 mod 4 : x belongs to G} = {1} and i^2 !== 1 (mod 4). Therefore, the exponent of G is greater than 2, accordingly the exponent of G is 4 and a(4) = 4.
MATHEMATICA
fa = FactorInteger; lamas[1] = 1; lamas[p_, s_]:= Which[Mod[p, 4]==3, p^(s-1)(p^2 - 1), Mod[p, 4] == 1, p^(s - 1)(p - 1), s ≥ 4, 2^(s - 1), s > 1, 4, s == 1, 2]; lamas[n_] := {aux = 1; Do[aux = LCM[aux, lamas[fa[n][[i, 1]], fa[n][[i, 2]]]], {i, 1, Length@fa[n]}]; aux}[[1]]; Table[lamas[n], {n, 100}]
PROG
(PARI) a(n)=
{
my(r=1, f=factor(n));
for(j=1, #f[, 1], my(p=f[j, 1], e=f[j, 2]);
if(p==2&&e<=2, r=lcm(r, 2^e));
if(p==2&&e>=3, r=lcm(r, 2^(e-1)));
if(p%4==1, r=lcm(r, (p-1)*p^(e-1)));
if(p%4==3, r=lcm(r, (p^2-1)*p^(e-1)));
);
return(r);
} \\ Jianing Song, Aug 29 2018
CROSSREFS
Equivalent of arithmetic functions in the ring of Gaussian integers (the corresponding functions in the ring of integers are in the parentheses): A062327 ("d", A000005), A317797 ("sigma", A000203), A079458 ("phi", A000010), this sequence ("psi", A002322), A086275 ("omega", A001221), A078458 ("Omega", A001222), A318608 ("mu", A008683).
Equivalent in the ring of Eisenstein integers: A319446.
KEYWORD
nonn
AUTHOR
José María Grau Ribas, Jul 07 2013
STATUS
approved