OFFSET
1,3
COMMENTS
Number of solutions to x^8 == 1 (mod n). - Jianing Song, Nov 10 2019
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
S. Finch, Quartic and octic characters modulo n, arXiv:0907.4894 [math.NT], 2009.
FORMULA
Multiplicative with a(p^e) = p^min(e-1, 4) if p = 2, gcd(8, p-1) if p > 2. - Jianing Song, Nov 10 2019
MAPLE
A247257 := proc(n)
local a, pf, p, r;
a := 1 ;
for pf in ifactors(n)[2] do
p := op(1, pf);
r := op(2, pf);
if p = 2 then
if r >= 5 then
a := a*16 ;
else
a := a*op(r, [1, 2, 4, 8]) ;
end if;
elif modp(p, 4) = 3 then
a := a*2;
elif modp(p, 8) = 5 then
a := a*4;
elif modp(p, 8) = 1 then
a := a*8;
else
error
end if;
end do:
a ;
end proc:
MATHEMATICA
g[p_, e_] := Which[p==2, 2^Min[e-1, 4], Mod[p, 4]==3, 2, Mod[p, 8]==5, 4, True, 8];
a[1] = 1; a[n_] := Times @@ g @@@ FactorInteger[n];
Array[a, 80] (* Jean-François Alcover, Nov 26 2017, after Charles R Greathouse IV *)
PROG
(PARI) g(p, e)=if(p==2, 2^min(e-1, 4), if(p%4==3, 2, if(p%8==5, 4, 8)))
a(n)=my(f=factor(n)); prod(i=1, #f~, g(f[i, 1], f[i, 2])) \\ Charles R Greathouse IV, Mar 02 2015
CROSSREFS
KEYWORD
mult,nonn,easy
AUTHOR
R. J. Mathar, Mar 02 2015
STATUS
approved