The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A103310 Largest prime primitive root of n that is less than n, or 0 if none exists. 6

%I #16 Feb 01 2023 12:27:07

%S 0,0,0,2,3,3,5,5,0,5,7,7,0,11,5,0,0,11,11,13,0,0,19,19,0,23,19,23,0,

%T 19,0,17,0,0,31,0,0,19,29,0,0,29,0,29,0,0,43,43,0,47,47,0,0,41,47,0,0,

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

%N Largest prime primitive root of n that is less than n, or 0 if none exists.

%H Robert Israel, <a href="/A103310/b103310.txt">Table of n, a(n) for n = 0..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PrimitiveRoot.html">Primitive Root</a>.

%p hasproot:= proc(n)

%p if n::odd then nops(numtheory:-factorset(n))=1

%p else padic:-ordp(n,2)=1 and nops(numtheory:-factorset(n/2))=1

%p fi

%p end proc;

%p hasproot(2):= true: hasproot(4):= true:

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

%p if not hasproot(n) then return 0 fi;

%p t:= numtheory:-phi(n);

%p p:= prevprime(n);

%p while not numtheory:-order(p,n)=t do

%p if p = 2 then return 0 fi;

%p p:= prevprime(p);

%p od;

%p p

%p end proc:

%p f(0):= 0: f(1):= 0: f(2):= 0:

%p map(f, [$0..100]); # _Robert Israel_, Sep 08 2020

%t a[n_] := Module[{R = PrimitiveRootList[n], s}, s = Select[R, # < n && PrimeQ[#]&]; If[s == {}, 0, s[[-1]]]];

%t Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Feb 01 2023 *)

%Y Cf. A001918, A046144, A046145, A046146, A103309.

%K easy,nonn

%O 0,4

%A _Harry J. Smith_, Jan 29 2005

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 May 18 03:12 EDT 2024. Contains 372617 sequences. (Running on oeis4.)