cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A247257 The number of octic characters modulo n.

Original entry on oeis.org

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

Views

Author

R. J. Mathar, Mar 02 2015

Keywords

Comments

Number of solutions to x^8 == 1 (mod n). - Jianing Song, Nov 10 2019

Crossrefs

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).

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