login
This site is supported by donations to The OEIS Foundation.

 

Logo

Annual Appeal: Today, Nov 11 2014, is the 4th anniversary of the launch of the new OEIS web site. 70,000 sequences have been added in these four years, all edited by volunteers. Please make a donation (tax deductible in the US) to help keep the OEIS running.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A046145 Smallest primitive root modulo n, or 0 if no root exists. 16
0, 0, 1, 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, 6, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,4

COMMENTS

The value 0 at index 0 says 0 has no primitive roots, but the 0 at index 1 says 1 has a primitive root of 0, the only real 0 in the sequence.

a(n) is nonzero if and only if n is 2, 4, or of the form p^k, or 2*p^k where p is an odd prime and k>0. - Tom Edgar, Jun 02 2014

LINKS

T. D. Noe, Table of n, a(n) for n=0..10000

Eric Weisstein's World of Mathematics, Primitive Root.

MAPLE

A046145 := proc(n)

  if n <=1 then

    0;

  else

    pr := numtheory[primroot](n) ;

    if pr = FAIL then

       return 0 ;

    else

       return pr ;

    end if;

  end if;

end proc:

seq(A046145(n), n=0..110) ;  # R. J. Mathar, Jul 08 2010

MATHEMATICA

smallestPrimitiveRoot[n_ /; n <= 1] = 0; smallestPrimitiveRoot[n_] := Block[{pr = PrimitiveRoot[n], g}, If[! NumericQ[pr], g = 0, g = 1; While[g <= pr, If[ CoprimeQ[g, n] && MultiplicativeOrder[g, n] == EulerPhi[n], Break[]]; g++]]; g]; smallestPrimitiveRoot /@ Range[0, 100] (* Jean-Fran├žois Alcover, Feb 15 2012 *)

f[n_] := Block[{pr = PrimitiveRootList[n]}, If[pr == {}, 0, pr[[1]]]]; Array[f, 105, 0] (* v10.0 Robert G. Wilson v, Nov 04 2014 *)

PROG

(PARI) for(i=0, 100, p=0; for(q=1, i-1, if(gcd(q, i)==1&&znorder(Mod(q, i))==eulerphi(i), p=q; break)); print1(p", ")) /* V. Raman, Nov 22 2012 */

CROSSREFS

Cf. A001918, A046144, A046146, A002233, A071894, A219027, A008330, A010554, A111076.

Sequence in context: A118176 A005731 A132962 * A103309 A174621 A007967

Adjacent sequences:  A046142 A046143 A046144 * A046146 A046147 A046148

KEYWORD

nonn,easy,nice,changed

AUTHOR

Eric W. Weisstein

EXTENSIONS

Initial terms corrected by Harry J. Smith, Jan 27 2005

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified November 26 14:56 EST 2014. Contains 250079 sequences.