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.
%I A023048 #72 Feb 13 2023 11:16:07 %S A023048 2,3,7,0,23,41,71,0,0,313,643,4111,457,1031,439,0,311,53173,191, %T A023048 107227,409,3361,2161,533821,0,12391,0,133321,15791,124153,5881,0, %U A023048 268969,48889,64609,0,36721,55441,166031,1373989,156601,2494381,95471,71761,95525767 %N A023048 Smallest prime having least positive primitive root n, or 0 if no such prime exists. %C A023048 a(n) = 0 iff n is a perfect power m^k, m >= 1, k >= 2 (i.e., a member of A001597). %C A023048 Of course if n is a perfect power then a(n) = 0, but it seems that the other direction is true only assuming the generalized Artin's conjecture. See the link from Tomás Oliveira e Silva below. - _Jianing Song_, Jan 22 2019 %D A023048 A. E. Western and J. C. P. Miller, Tables of Indices and Primitive Roots. Royal Society Mathematical Tables, Vol. 9, Cambridge Univ. Press, 1968, p. XLIV. %H A023048 N. J. A. Sloane, <a href="/A023048/b023048.txt">Table of n, a(n) for n = 1..107</a> (from the web page of Tomás Oliveira e Silva) %H A023048 Wouter Meeussen, <a href="/A023048/a023048_1.txt">Smallest Primes with Specified Least Primitive Root</a> %H A023048 Tomás Oliveira e Silva, <a href="http://sweet.ua.pt/tos/p_roots.html">Least primitive root of prime numbers</a> %H A023048 <a href="/index/Pri#primes_root">Index entries for primes by primitive root</a> %F A023048 a(n) = min { prime(k) | A001918(k) = n } U {0} = A000040(A066529(n)) (or zero). - _M. F. Hasler_, Jun 01 2018 %e A023048 a(2) = 3, since 3 has 2 as smallest positive primitive root and no prime p < 3 has 2 as smallest positive primitive root. %e A023048 a(24) = 533821, since prime 533821 has 24 as smallest positive primitive root and no prime p < 533821 has 24 as smallest positive primitive root. %t A023048 t = Table[0, {100}]; Do[a = PrimitiveRoot@Prime@n; If[a < 101 && t[[a]] == 0, t[[a]] = n], {n, 10^6}]; Unprotect[Prime]; Prime[0] = 0; Prime@t; Clear[Prime]; Protect[Prime] (* _Robert G. Wilson v_, Dec 15 2005 *) %o A023048 (Python) %o A023048 from sympy import nextprime, perfect_power, primitive_root %o A023048 def a(n): %o A023048 if perfect_power(n): return 0 %o A023048 p = 2 %o A023048 while primitive_root(p) != n: p = nextprime(p) %o A023048 return p %o A023048 print([a(n) for n in range(1, 40)]) # _Michael S. Branicky_, Feb 13 2023 %o A023048 (Python) # faster version for initial segment of sequence %o A023048 from itertools import count, islice %o A023048 from sympy import nextprime, perfect_power, primitive_root %o A023048 def agen(): # generator of terms %o A023048 p, adict, n = 2, {None: 0}, 1 %o A023048 for k in count(1): %o A023048 v = primitive_root(p) %o A023048 if v not in adict: %o A023048 adict[v] = p %o A023048 if perfect_power(n): adict[n] = 0 %o A023048 while n in adict: yield adict[n]; n += 1 %o A023048 p = nextprime(p) %o A023048 print(list(islice(agen(), 40))) # _Michael S. Branicky_, Feb 13 2023 %Y A023048 Cf. A001122-A001126, A061323-A061335, A061730-A061741. %Y A023048 Indices of the primes: A066529. %Y A023048 For records see A133433. See A133432 for a version without the 0's. %K A023048 nonn %O A023048 1,1 %A A023048 _David W. Wilson_ %E A023048 Comment corrected by _Christopher J. Smyth_, Oct 16 2013