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.

A172480 Odd primes p such that there are as many primitive roots (mod p) in the interval [0,p/2] as in the interval [p/2,p].

Original entry on oeis.org

5, 7, 13, 17, 29, 31, 37, 41, 43, 53, 61, 67, 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, 367, 373, 389, 397, 401, 409, 421, 433, 449, 457, 461, 487, 509, 521, 541, 557, 569
Offset: 1

Views

Author

Emmanuel Vantieghem, Feb 04 2010

Keywords

Comments

The sequence contains all the primes of the form 4m+1 (A002144).
The sequence also contains some primes of the form 4m+3 (see them in A172490).

Crossrefs

A002144 is a subsequence.

Programs

  • Maple
    filter:= proc(p) local m; uses NumberTheory;
      if not isprime(p) then return false fi;
      if p mod 4 = 1 then return true fi;
      m:= Totient(Totient(p))/2;
      PrimitiveRoot(p,ith=m+1)=PrimitiveRoot(p,greaterthan=floor(p/2))
    end proc:
    select(filter, [seq(i,i=5..1000,2)]); # Robert Israel, Nov 23 2019
  • Mathematica
    << NumberTheory`NumberTheoryFunctions` m = 2; s = {}; While[m < 10000, m++; p = Prime[m]; If[Mod[p, 4] == 1, s = {s, p}, q = (p - 1)/2; g = PrimitiveRoot[p]; se = Select[Range[p - 1], GCD[ #, p - 1] == 1 &]; e = Length[se]; j = 0; t = 0; While[j < e, j++; h = PowerMod[g, se[[j]], p]; If[h <= q, t = t + 1,] ]; If[e == 2t, s = {s, p},] ] ]; s = Flatten[s]