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
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
LINKS
Eric Weisstein's World of Mathematics, Primitive Root.
MAPLE
hasproot:= proc(n)
if n::odd then nops(numtheory:-factorset(n))=1
else padic:-ordp(n, 2)=1 and nops(numtheory:-factorset(n/2))=1
fi
end proc;
hasproot(2):= true: hasproot(4):= true:
f:= proc(n) local p, t;
if not hasproot(n) then return 0 fi;
t:= numtheory:-phi(n);
p:= prevprime(n);
while not numtheory:-order(p, n)=t do
if p = 2 then return 0 fi;
p:= prevprime(p);
od;
p
end proc:
f(0):= 0: f(1):= 0: f(2):= 0:
map(f, [$0..100]); # Robert Israel, Sep 08 2020
MATHEMATICA
a[n_] := Module[{R = PrimitiveRootList[n], s}, s = Select[R, # < n && PrimeQ[#]&]; If[s == {}, 0, s[[-1]]]];
Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Feb 01 2023 *)
CROSSREFS
Sequence in context: A158745 A175108 A265145 * A046146 A081768 A273493
KEYWORD
easy,nonn
AUTHOR
Harry J. Smith, Jan 29 2005
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 19 18:05 EDT 2024. Contains 371798 sequences. (Running on oeis4.)