OFFSET
1,7
COMMENTS
The size of the set of numbers j^8 mod n, gcd(j,n)=1, 1<=j<=n.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..16384
Richard J. Mathar, Size of the Set of Residues of Integer Powers of Fixed Exponent, research paper, 2017.
FORMULA
Multiplicative with a(2^e) = 1 for e<=4, a(2^e) = 2^(e-5) for e>=5; a(p^e) = (p-1)*p^(e-1)/8 for p == 1 (mod 8); a(p^e) = (p-1)*p^(e-1)/4 for p == 5 (mod 8); a(p^e) = (p-1)*p^(e-1)/2 for p == {3,7} (mod 8). - R. J. Mathar, Oct 15 2017 [corrected by Georg Fischer, Jul 21 2022]
MAPLE
MATHEMATICA
a[n_] := EulerPhi[n]/Count[Range[0, n - 1]^8 - 1, k_ /; Divisible[k, n]];
Array[a, 100] (* Jean-François Alcover, May 24 2023 *)
f[p_, e_] := (p - 1)*p^(e - 1)/Switch[Mod[p, 8], 1, 8, 5, 4, _, 2]; f[2, e_] := If[e <= 4, 1, 2^(e - 5)]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Aug 10 2023 *)
PROG
(PARI)
\\ The following two functions by Charles R Greathouse IV, from A247257:
g(p, e) = if(p==2, 2^min(e-1, 4), if(p%4==3, 2, if(p%8==5, 4, 8)));
A247257(n) = my(f=factor(n)); prod(i=1, #f~, g(f[i, 1], f[i, 2]));
CROSSREFS
KEYWORD
nonn,mult
AUTHOR
R. J. Mathar, Oct 10 2017
STATUS
approved