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.

A001918 Least positive primitive root of n-th prime.

This page as a plain text file.
%I A001918 M0242 N0083 #89 Jul 21 2025 11:57:47
%S A001918 1,2,2,3,2,2,3,2,5,2,3,2,6,3,5,2,2,2,2,7,5,3,2,3,5,2,5,2,6,3,3,2,3,2,
%T A001918 2,6,5,2,5,2,2,2,19,5,2,3,2,3,2,6,3,7,7,6,3,5,2,6,5,3,3,2,5,17,10,2,3,
%U A001918 10,2,2,3,7,6,2,2,5,2,5,3,21,2,2,7,5,15,2,3,13,2,3,2,13,3,2,7,5,2,3,2,2,2,2,2,3
%N A001918 Least positive primitive root of n-th prime.
%C A001918 If k is a primitive root of p=4m+1, then p-k is too. If k is a primitive root of p=4m+3, then p-k isn't, but has order 2m+1. - _Jon Perry_, Sep 07 2014
%D A001918 M. Abramowitz and I. A. Stegun, eds., Handbook of Mathematical Functions, National Bureau of Standards Applied Math. Series 55, 1964 (and various reprintings), p. 864.
%D A001918 T. M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, 1976, page 213.
%D A001918 CRC Handbook of Combinatorial Designs, 1996, p. 615.
%D A001918 P. Fan and M. Darnell, Sequence Design for Communications Applications, Wiley, NY, 1996, Table A.1.
%D A001918 G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, th. 111.
%D A001918 Hua Loo Keng, Introduction To Number Theory, 'Table of least primitive roots for primes less than 50000', pp. 52-6, Springer NY 1982.
%D A001918 R. Osborn, Tables of All Primitive Roots of Odd Primes Less Than 1000, Univ. Texas Press, 1961.
%D A001918 Paulo Ribenboim, The Little Book of Bigger Primes, Springer-Verlag NY 2004. See p. 20.
%D A001918 N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D A001918 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A001918 N. J. A. Sloane, <a href="/A001918/b001918.txt">Table of n, a(n) for n = 1..10000</a>
%H A001918 M. Abramowitz and I. A. Stegun, eds., <a href="https://www.convertit.com/Go/ConvertIt/Reference/AMS55.ASP">Handbook of Mathematical Functions</a>, National Bureau of Standards, Applied Math. Series 55, Tenth Printing, 1972 [alternative scanned copy].
%H A001918 Loo-keng Hua, <a href="https://dx.doi.org/10.1090/S0002-9904-1942-07767-6">On the least primitive root of a prime</a>, Bull. Amer. Math. Soc. 48 (1942), 726-730.
%H A001918 K. Matthews, <a href="http://www.numbertheory.org/php/lprimroot.html">Finding the least primitive root (mod p), p an odd prime</a>
%H A001918 Jorma K. Merikoski, Pentti Haukkanen, and Timo Tossavainen, <a href="https://doi.org/10.7546/nntdm.2024.30.3.516-529">The congruence x^n = -a^n (mod m): Solvability and related OEIS sequences</a>, Notes. Num. Theor. Disc. Math. (2024) Vol. 30, No. 3, 516-529. See p. 519.
%H A001918 T. Oliveira e Silva, <a href="https://sweet.ua.pt/tos/p_roots.html">Least primitive root of prime numbers</a>.
%H A001918 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimitiveRoot.html">Primitive Root</a>.
%e A001918 modulo 7: 3^6=1, 3^2=2, 3^7=3, 3^4=4, 3^5=5, 3^3=6, 7=prime(4), 3=a(4).
%p A001918 A001918 := proc(n)
%p A001918         numtheory[primroot](ithprime(n)) ;
%p A001918 end proc:
%t A001918 Table[PrimitiveRoot@Prime@n, {n, 101}] (* _Robert G. Wilson v_, Dec 15 2005 *)
%t A001918 PrimitiveRoot[Prime[Range[110]]] (* _Harvey P. Dale_, Jan 13 2013 *)
%o A001918 (PARI) for(x=1, 1000, print1(lift(znprimroot(prime(x))), ", "))
%o A001918 (Sage) [primitive_root(p) for p in primes(570)] # _Zerinvary Lajos_, May 24 2009
%o A001918 (Python)
%o A001918 from sympy import prime
%o A001918 from sympy.ntheory.residue_ntheory import primitive_root
%o A001918 def A001918(n): return primitive_root(prime(n)) # _Chai Wah Wu_, Sep 13 2022
%Y A001918 A column of A060749. Cf. A002233.
%K A001918 nonn,nice,easy
%O A001918 1,2
%A A001918 _N. J. A. Sloane_