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!)
A023049 Smallest prime > n having primitive root n, or 0 if no such prime exists. 2

%I #21 Mar 05 2019 08:26:10

%S 2,3,5,0,7,11,11,11,0,17,13,17,19,17,19,0,23,29,23,23,23,31,47,31,0,

%T 29,29,41,41,41,47,37,43,41,37,0,59,47,47,47,47,59,47,47,47,67,59,53,

%U 0,53,53,59,71,59,59,59,67,73,61,73,67,71,67,0,71,79,71,71,71,79,83,83,83,79

%N Smallest prime > n having primitive root n, or 0 if no such prime exists.

%C Indices of record values of a(n)-n are (1, 2, 3, 6, 10, 18, 23, 78, 102, 105, 488, 652, 925, ...). Record values of a(n)/n are 3/2, 5/3, 11/6, 47/23, ... (Is there another n with a(n) > 2n ?) - _M. F. Hasler_, Feb 21 2017

%H Robert Israel, <a href="/A023049/b023049.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) = 0 iff n is a square > 1. - _M. F. Hasler_, Feb 21 2017

%p f:= proc(n) local p;

%p if issqr(n) then return 0 fi;

%p p:= nextprime(n);

%p do

%p if numtheory:-order(n,p) = p-1 then return p fi;

%p p:= nextprime(p);

%p od

%p end proc:

%p f(1):= 2:

%p map(f, [$1..100]); # _Robert Israel_, Feb 21 2017

%t a[n_] := For[p = 2, p <= 2 n + 1, p = NextPrime[p], If[MemberQ[ PrimitiveRootList[p], n], Return[p]]] /. Null -> 0; Array[a, 100] (* _Jean-François Alcover_, Mar 05 2019 *)

%o (PARI) A023049(n)={issquare(n)||forprime(p=n+1,,znorder(Mod(n,p))==p-1&&return(p));(n==1)*2} \\ _M. F. Hasler_, Feb 21 2017

%Y See also A056619, where the primitive root may be larger than the prime, whereas in A023049 it may not be.

%K nonn

%O 1,1

%A _David W. Wilson_

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 24 00:30 EDT 2024. Contains 371917 sequences. (Running on oeis4.)