A247257 The number of octic characters modulo n.
1, 1, 2, 2, 4, 2, 2, 4, 2, 4, 2, 4, 4, 2, 8, 8, 8, 2, 2, 8, 4, 2, 2, 8, 4, 4, 2, 4, 4, 8, 2, 16, 4, 8, 8, 4, 4, 2, 8, 16, 8, 4, 2, 4, 8, 2, 2, 16, 2, 4, 16, 8, 4, 2, 8, 8, 4, 4, 2, 16, 4, 2, 4, 16, 16, 4, 2, 16, 4, 8, 2, 8, 8, 4, 8, 4, 4, 8, 2, 32
Offset: 1
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
- Steven Finch, Quartic and octic characters modulo n, arXiv:0907.4894 [math.NT], 2009.
Crossrefs
Programs
-
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 *)
-
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
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
Comments