cp's OEIS Frontend

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.

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

This page as a plain text file.
%I A103310 #17 Feb 16 2025 08:32:56
%S A103310 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 A103310 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 A103310 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 A103310 Largest prime primitive root of n that is less than n, or 0 if none exists.
%H A103310 Robert Israel, <a href="/A103310/b103310.txt">Table of n, a(n) for n = 0..10000</a>
%H A103310 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PrimitiveRoot.html">Primitive Root</a>.
%p A103310 hasproot:= proc(n)
%p A103310   if n::odd then nops(numtheory:-factorset(n))=1
%p A103310   else padic:-ordp(n,2)=1 and nops(numtheory:-factorset(n/2))=1
%p A103310   fi
%p A103310 end proc;
%p A103310 hasproot(2):= true: hasproot(4):= true:
%p A103310 f:= proc(n) local p,t;
%p A103310   if not hasproot(n) then return 0 fi;
%p A103310   t:= numtheory:-phi(n);
%p A103310   p:= prevprime(n);
%p A103310   while not numtheory:-order(p,n)=t do
%p A103310     if p = 2 then return 0 fi;
%p A103310     p:= prevprime(p);
%p A103310   od;
%p A103310   p
%p A103310 end proc:
%p A103310 f(0):= 0: f(1):= 0: f(2):= 0:
%p A103310 map(f, [$0..100]); # _Robert Israel_, Sep 08 2020
%t A103310 a[n_] := Module[{R = PrimitiveRootList[n], s}, s = Select[R, # < n && PrimeQ[#]&]; If[s == {}, 0, s[[-1]]]];
%t A103310 Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, Feb 01 2023 *)
%Y A103310 Cf. A001918, A046144, A046145, A046146, A103309.
%K A103310 easy,nonn
%O A103310 0,4
%A A103310 _Harry J. Smith_, Jan 29 2005