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.

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

This page as a plain text file.
%I A266987 #49 Feb 02 2016 03:34:24
%S A266987 2,5,13,17,19,29,37,41,53,61,73,89,97,101,109,113,137,149,157,173,181,
%T A266987 193,197,229,233,241,257,269,277,281,293,307,313,317,337,349,353,373,
%U A266987 389,397,401,409,421,433,449
%N A266987 Primes p for which the average of the primitive roots equals p/2.
%C A266987 From _Robert Israel_, Feb 01 2016: (Start)
%C A266987 Union of A002144 and A267010.
%C A266987 Contains A002144 because for each of these primes, x is a primitive root iff p-x is a primitive root. (End)
%H A266987 Robert Israel, <a href="/A266987/b266987.txt">Table of n, a(n) for n = 1..8213</a>
%F A266987 a(n) = prime(A266986(n)).
%e A266987 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.
%p A266987 proots := proc(n)
%p A266987     local r,eulphi,m;
%p A266987     if n = 1 then
%p A266987         return {0} ;
%p A266987     end if;
%p A266987     eulphi := numtheory[phi](n) ;
%p A266987     r := {} ;
%p A266987     for m from 0 to n-1 do
%p A266987         if numtheory[order](m,n) = eulphi then
%p A266987             r := r union {m} ;
%p A266987         end if;
%p A266987     end do:
%p A266987     return r;
%p A266987 end proc:
%p A266987 isA266987 := proc(n)
%p A266987     local r;
%p A266987     if isprime(n) then
%p A266987         r := convert(proots(n),list) ;
%p A266987         2*add(pr, pr=r)  = n*nops(r) ;
%p A266987     else
%p A266987         false;
%p A266987     end if;
%p A266987 end proc:
%p A266987 for n from 1 to 500 do
%p A266987     if isA266987(n) then
%p A266987         printf("%d,",n);
%p A266987     end if;
%p A266987 end do: # _R. J. Mathar_, Jan 12 2016
%p A266987 Filter:= proc(p) local x, s,js;
%p A266987   if p mod 4 = 1 then return true fi;
%p A266987   x:= numtheory:-primroot(p);
%p A266987   js:= select(t -> igcd(t,p-1)=1, [$1..p-2]);
%p A266987   s:= add(x&^ j mod p, j=js);
%p A266987   evalb(s = p/2 * nops(js))
%p A266987 end proc:
%p A266987 select(Filter, [seq(ithprime(i),i=1..1000)]); # _Robert Israel_, Feb 01 2016
%t A266987 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 &)]]]
%t A266987 (* second program (version >= 10): *)
%t A266987 Select[Prime[Range[100]], Mean[PrimitiveRootList[#]] == #/2&] (* _Jean-François Alcover_, Jan 12 2016 *)
%Y A266987 Cf. A002144, A008330, A060749, A088144, A266986, A267010.
%K A266987 nonn
%O A266987 1,1
%A A266987 _Dimitri Papadopoulos_, Jan 08 2016