login
Difference between the greatest primitive root and the least primitive root of the n-th prime.
1

%I #34 Oct 22 2023 15:44:19

%S 0,0,1,2,6,9,11,13,16,25,21,33,29,31,40,49,54,57,61,62,63,74,78,83,87,

%T 97,96,102,97,107,115,126,131,133,145,140,147,157,160,169,174,177,170,

%U 183,193,194,205,211,222,217,227,230,227,242,251,256,265,263,267,275,274

%N Difference between the greatest primitive root and the least primitive root of the n-th prime.

%H Amiram Eldar, <a href="/A128906/b128906.txt">Table of n, a(n) for n = 1..1001</a> (adapted to offset 1 by Sidney Cadot).

%F a(n) = A071894(n) - A001918(n).

%t Table[(k=p-1;While[MultiplicativeOrder[k,p]!=p-1,k--];k)-PrimitiveRoot@p,{p, Prime@Range@100}] (* _Giorgos Kalogeropoulos_, Sep 28 2023 *)

%o (PARI) a(n)=my(p=prime(n));forstep(r=p-1,2,-1,if(znorder(Mod(r,p))==p-1,return(r-lift(znprimroot(p)))));

%o vector(66,n,a(n)) \\ _Joerg Arndt_, Sep 29 2023

%Y Cf. A001918, A071894.

%K nonn

%O 1,4

%A _Robert G. Wilson v_, Apr 21 2007

%E a(1)=0 inserted by _Georg Fischer_, Dec 11 2022