login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A046147
Triangle read by rows in which row n lists the primitive roots mod n (omitting numbers n without a primitive root).
6
1, 2, 3, 2, 3, 5, 3, 5, 2, 5, 3, 7, 2, 6, 7, 8, 2, 6, 7, 11, 3, 5, 3, 5, 6, 7, 10, 11, 12, 14, 5, 11, 2, 3, 10, 13, 14, 15, 7, 13, 17, 19, 5, 7, 10, 11, 14, 15, 17, 19, 20, 21, 2, 3, 8, 12, 13, 17, 22, 23, 7, 11, 15, 19, 2, 5, 11, 14, 20, 23, 2, 3, 8, 10, 11, 14, 15, 18, 19, 21, 26
OFFSET
2,2
LINKS
T. D. Noe, Table of n, a(n) for n = 2..3119 (first 99 nonempty rows of triangle, flattened)
Eric Weisstein's World of Mathematics, Primitive Root.
EXAMPLE
n followed by primitive roots, if any:
1 -
2 1
3 2
4 3
5 2 3
6 5
7 3 5
8 -
9 2 5
10 3 7
11 2 6 7 8
12 -
13 2 6 7 11
...
MAPLE
f:= proc(n) local p, k, m, R;
p:= numtheory:-primroot(n);
if p = FAIL then return NULL fi;
m:= numtheory:-phi(n);
k:= select(i -> igcd(i, m) = 1, [$1..m-1]);
op(sort(map(t -> p&^t mod n, k)))
end proc:
f(2):= 1:
map(f, [$2..50]); # Robert Israel, Apr 28 2017
MATHEMATICA
a[n_] := Select[Range[n-1], GCD[#, n] == 1 && MultiplicativeOrder[#, n] == EulerPhi[n]& ]; Table[a[n], {n, 1, 30}] // Flatten (* Jean-François Alcover, Oct 23 2012 *)
PrimitiveRootList[Range[Prime[10]]]//Flatten (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Sep 10 2016 *)
PROG
(PARI) a_row(r) = my(v=[], phi=eulerphi(r)); for(i=1, r-1, if(1 == gcd(r, i) && phi == znorder(Mod(i, r)), v=concat(v, i))); v \\ Ruud H.G. van Tol, Oct 23 2023
CROSSREFS
Cf. A001918, A046144 (row lengths), A046145, A046146.
Cf. A060749, A306252 (1st column), A306253 (last/maximum element)
Sequence in context: A124459 A283360 A256366 * A251865 A306196 A052369
KEYWORD
nonn,tabf
EXTENSIONS
Edited by Robert Israel, Apr 28 2017
STATUS
approved