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.

Showing 1-2 of 2 results.

A266987 Primes p for which the average of the primitive roots equals p/2.

Original entry on oeis.org

2, 5, 13, 17, 19, 29, 37, 41, 53, 61, 73, 89, 97, 101, 109, 113, 137, 149, 157, 173, 181, 193, 197, 229, 233, 241, 257, 269, 277, 281, 293, 307, 313, 317, 337, 349, 353, 373, 389, 397, 401, 409, 421, 433, 449
Offset: 1

Views

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

From Robert Israel, Feb 01 2016: (Start)
Union of A002144 and A267010.
Contains A002144 because for each of these primes, x is a primitive root iff p-x is a primitive root. (End)

Examples

			a(13) = 13 since the primitive roots of 13 are 2, 6, 7, and 11 and the average of these primitive roots is (2+6+7+11)/phi(12) = 26/4 = 13/2.
		

Crossrefs

Programs

  • Maple
    proots := proc(n)
        local r,eulphi,m;
        if n = 1 then
            return {0} ;
        end if;
        eulphi := numtheory[phi](n) ;
        r := {} ;
        for m from 0 to n-1 do
            if numtheory[order](m,n) = eulphi then
                r := r union {m} ;
            end if;
        end do:
        return r;
    end proc:
    isA266987 := proc(n)
        local r;
        if isprime(n) then
            r := convert(proots(n),list) ;
            2*add(pr, pr=r)  = n*nops(r) ;
        else
            false;
        end if;
    end proc:
    for n from 1 to 500 do
        if isA266987(n) then
            printf("%d,",n);
        end if;
    end do: # R. J. Mathar, Jan 12 2016
    Filter:= proc(p) local x, s,js;
      if p mod 4 = 1 then return true fi;
      x:= numtheory:-primroot(p);
      js:= select(t -> igcd(t,p-1)=1, [$1..p-2]);
      s:= add(x&^ j mod p, j=js);
      evalb(s = p/2 * nops(js))
    end proc:
    select(Filter, [seq(ithprime(i),i=1..1000)]); # Robert Israel, Feb 01 2016
  • Mathematica
    A = Table[Total[Flatten[Position[Table[MultiplicativeOrder[i, Prime[k]], {i, Prime[k] - 1}],Prime[k] - 1]]]/(EulerPhi[Prime[k] - 1] Prime[k]/2), {k, 1, 100}]; Prime[Flatten[Position[A, _?(# == 1 &)]]]
    (* second program (version >= 10): *)
    Select[Prime[Range[100]], Mean[PrimitiveRootList[#]] == #/2&] (* Jean-François Alcover, Jan 12 2016 *)

Formula

a(n) = prime(A266986(n)).

A266989 Primes for which the average of the primitive roots is < p/2.

Original entry on oeis.org

31, 43, 67, 223, 379, 491, 619, 631, 643, 683, 859, 883, 907, 1051, 1091, 1423, 1747, 1987, 2143, 2347, 2371, 2467, 2531, 2767, 3307, 3643, 3691, 3739, 3823, 3931, 4019, 4219, 4519, 4691, 4987, 5059, 5107, 5347, 5683, 5827, 6043
Offset: 1

Views

Author

Dimitri Papadopoulos, Jan 08 2016

Keywords

Comments

These primes are congruent to 3 (mod 4).

Examples

			a(1)=31. The primitive roots of 31 are 3, 11, 12, 13, 17, 21, 22, and 24.
Their average is (3+11+12+13+17+21+22+24)/phi(30)=123/8<31/2.
		

Crossrefs

Programs

  • Maple
    f:= proc(p) local g;
      if not isprime(p) then return false fi;
      g:= numtheory[primroot](p);
      evalb(add(g&^i mod p, i = select(t->igcd(t,p-1)=1, [$1..p-2]))
         < p/2 * numtheory:-phi(p-1))
    end proc:
    select(f, [seq(i,i=3..10000,4)]); # Robert Israel, Feb 09 2016
  • Mathematica
    A = Table[Total[Flatten[Position[Table[MultiplicativeOrder[i, Prime[k]], {i, Prime[k] - 1}],Prime[k] - 1]]]/(EulerPhi[Prime[k] - 1] Prime[k]/2), {k, 1,100}]; Prime[Flatten[Position[A, _?(# < 1 &)]]]
  • PARI
    ar(p) = my(r, pr, j); r=vector(eulerphi(p-1)); pr=znprimroot(p); for(i=1, p-1, if(gcd(i, p-1)==1, r[j++]=lift(pr^i))); vecsort(r) ;
    isok(p) = my(vr = ar(p)); vecsum(vr)/#vr < p/2;
    lista(nn) = forprime(p=2, nn, if (isok(p), print1(p, ", "))); \\ Michel Marcus, Feb 09 2016

Formula

a(n) = prime(A266988(n)).
Showing 1-2 of 2 results.