OFFSET
1,63
COMMENTS
3-rank of the multiplicative group of integers modulo n.
LINKS
Jianing Song, Table of n, a(n) for n = 1..10000
FORMULA
Additive with a(3) = 0, a(3^e) = 1, e >= 2; a(p^e) = 1 for p == 1 (mod 3), 0 for p == 2 (mod 3).
EXAMPLE
a(63) = 2 since (Z/63Z)* = C_6 X C_6 has 3-rank 2.
MATHEMATICA
f[p_, e_] := If[Mod[p, 3] == 1, 1, 0]; f[3, e_] := 1; f[3, 1] = 0; a[1] = 0; a[n_] := Plus @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Oct 05 2023 *)
PROG
(PARI) a(n)=my(f=factor(n)); sum(i=1, #f~, if(f[i, 1]==3, min(f[i, 2]-1, 1), if(f[i, 1]%3==1, 1, 0)))
(Python)
from sympy import factorint
def A357905(n): return sum(1 for p, e in factorint(n).items() if (p!=3 or e!=1) and p%3!=2) # Chai Wah Wu, Oct 19 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jianing Song, Oct 19 2022
STATUS
approved