A128906 Difference between the greatest primitive root and the least primitive root of the n-th prime.
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, 97, 96, 102, 97, 107, 115, 126, 131, 133, 145, 140, 147, 157, 160, 169, 174, 177, 170, 183, 193, 194, 205, 211, 222, 217, 227, 230, 227, 242, 251, 256, 265, 263, 267, 275, 274
Offset: 1
Keywords
Links
- Amiram Eldar, Table of n, a(n) for n = 1..1001 (adapted to offset 1 by Sidney Cadot).
Programs
-
Mathematica
Table[(k=p-1;While[MultiplicativeOrder[k,p]!=p-1,k--];k)-PrimitiveRoot@p,{p, Prime@Range@100}] (* Giorgos Kalogeropoulos, Sep 28 2023 *)
-
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))))); vector(66,n,a(n)) \\ Joerg Arndt, Sep 29 2023
Extensions
a(1)=0 inserted by Georg Fischer, Dec 11 2022