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.

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

Original entry on oeis.org

0, 0, 0, 2, 3, 2, 5, 3, 0, 2, 3, 2, 0, 2, 3, 0, 0, 3, 5, 2, 0, 0, 7, 5, 0, 2, 7, 2, 0, 2, 0, 3, 0, 0, 3, 0, 0, 2, 3, 0, 0, 7, 0, 3, 0, 0, 5, 5, 0, 3, 3, 0, 0, 2, 5, 0, 0, 0, 3, 2, 0, 2, 3, 0, 0, 0, 0, 2, 0, 0, 0, 7, 0, 5, 5, 0, 0, 0, 0, 3, 0, 2, 7, 2, 0, 0, 3, 0, 0, 3, 0, 0, 0, 0, 5, 0, 0, 5, 3, 0, 0, 2, 0, 5, 0
Offset: 0

Views

Author

Harry J. Smith, Jan 29 2005

Keywords

Comments

Differs from A046145 only for indices n = 2, 41, 109, 151, 229, ...; see A103335. - Jeppe Stig Nielsen, Mar 06 2020

Crossrefs

Programs

  • Maple
    F:= proc(n)
      local r;
      r:= numtheory:-primroot(n);
      while r::integer and not isprime(r) do
        r:= numtheory:-primroot(r,n);
      od:
      if r = FAIL then 0 else r fi
    end proc:
    seq(F(n),n=0..200); # Robert Israel, May 18 2015
  • Mathematica
    a[n_] := SelectFirst[PrimitiveRootList[n], PrimeQ[#] && # < n&] /. Missing["NotFound"] -> 0;
    Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Nov 15 2017 *)