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.

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

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, Apr 21 2007

Keywords

Crossrefs

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

Formula

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

Extensions

a(1)=0 inserted by Georg Fischer, Dec 11 2022