login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

The number of octic characters modulo n.
9

%I #49 Dec 13 2024 11:24:27

%S 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,

%T 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,

%U 4,2,16,4,8,2,8,8,4,8,4,4,8,2,32

%N The number of octic characters modulo n.

%C Number of solutions to x^8 == 1 (mod n). - _Jianing Song_, Nov 10 2019

%H Charles R Greathouse IV, <a href="/A247257/b247257.txt">Table of n, a(n) for n = 1..10000</a>

%H Steven Finch, <a href="http://arxiv.org/abs/0907.4894">Quartic and octic characters modulo n</a>, arXiv:0907.4894 [math.NT], 2009.

%F 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

%p A247257 := proc(n)

%p local a,pf,p,r;

%p a := 1 ;

%p for pf in ifactors(n)[2] do

%p p := op(1,pf);

%p r := op(2,pf);

%p if p = 2 then

%p if r >= 5 then

%p a := a*16 ;

%p else

%p a := a*op(r,[1,2,4,8]) ;

%p end if;

%p elif modp(p,4) = 3 then

%p a := a*2;

%p elif modp(p,8) = 5 then

%p a := a*4;

%p elif modp(p,8) = 1 then

%p a := a*8;

%p else

%p error

%p end if;

%p end do:

%p a ;

%p end proc:

%t g[p_, e_] := Which[p==2, 2^Min[e-1, 4], Mod[p, 4]==3, 2, Mod[p, 8]==5, 4, True, 8];

%t a[1] = 1; a[n_] := Times @@ g @@@ FactorInteger[n];

%t Array[a, 80] (* _Jean-François Alcover_, Nov 26 2017, after _Charles R Greathouse IV_ *)

%o (PARI) g(p,e)=if(p==2, 2^min(e-1,4), if(p%4==3, 2, if(p%8==5, 4, 8)))

%o a(n)=my(f=factor(n)); prod(i=1,#f~, g(f[i,1],f[i,2])) \\ _Charles R Greathouse IV_, Mar 02 2015

%Y Number of solutions to x^k == 1 (mod n): A060594 (k=2), A060839 (k=3), A073103 (k=4), A319099 (k=5), A319100 (k=6), A319101 (k=7), this sequence (k=8).

%K mult,nonn,easy

%O 1,3

%A _R. J. Mathar_, Mar 02 2015