login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A079060 Least k such that the least positive primitive root of prime(k) equals prime(n). 1
2, 4, 9, 20, 117, 88, 64, 43, 326, 1842, 775, 3894, 14401, 9204, 24092, 14837, 57481, 90901, 242495, 260680, 61005, 508929, 1084588, 436307, 1124509, 1824015, 2969632, 2052357, 4006960, 5241202, 10253662, 30802809, 17480124, 73915355, 98931475, 42664033 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
a(49) = 1247136427. For n > 45, a(n) > 1.5*10^9 except n = 49. - David A. Corneth, Feb 15 2023
LINKS
PROG
(PARI) a(n) = {my(p=prime(n), s=1); while(p!=lift(znprimroot(prime(s))), s++); s; } \\ Modified by Jinyuan Wang, Apr 03 2020
(PARI) upto(u, {maxn = 100}) = { my(t = 1, m = Map(), res = []); forprime(p = 2, oo, mapput(m, p, t); t++; if(t > maxn, break ) ); t = 1; u = prime(u); forprime(p = 2, u, c = lift(znprimroot(p)); if(mapisdefined(m, c), ind = mapget(m, c); if(ind > #res, res = concat(res, vector(ind - #res)) ); if(res[ind] == 0, res[ind] = t; ) ); t++ ); res } \\ David A. Corneth, Feb 15 2023
(Python)
from sympy import nextprime, primitive_root
def a(n):
k, pk, pn = 1, 2, prime(n)
while primitive_root(pk) != pn: k += 1; pk = nextprime(pk)
return k
print([a(n) for n in range(1, 19)]) # Michael S. Branicky, Feb 13 2023
(Python) # faster version for segments of sequence
from itertools import count, islice
from sympy import isprime, nextprime, prime, primepi, primitive_root
def agen(startk=1, startn=1): # generator of terms
p, vdict, adict, n = prime(startk), dict(), dict(), startn
for k in count(startk):
v = primitive_root(p)
if v not in vdict and isprime(v):
vdict[v] = k
adict[primepi(v)] = k
while n in adict: yield adict[n]; n += 1
p = nextprime(p)
print(list(islice(agen(), 18))) # Michael S. Branicky, Feb 14 2023
CROSSREFS
Sequence in context: A264293 A370315 A034750 * A225173 A346737 A030039
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Feb 02 2003
EXTENSIONS
a(17)-a(18) from Jinyuan Wang, Apr 03 2020
a(19)-a(36) from Michael S. Branicky, Feb 14 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 17 20:47 EDT 2024. Contains 371767 sequences. (Running on oeis4.)