

A229710


Least m of maximal order mod n such that m is a sum of two squares.


2



2, 5, 5, 5, 2, 13, 2, 5, 2, 5, 2, 5, 5, 5, 2, 13, 2, 13, 5, 5, 2, 37, 2, 5, 2, 13, 13, 5, 2, 5, 2, 5, 2, 13, 2, 13, 13, 5, 5, 13, 2, 5, 5, 5, 5, 13, 5, 37, 2, 5, 2, 5, 2, 37, 2, 13, 2, 13, 2, 5, 2, 5, 2, 5, 2, 17, 13, 5, 5, 5, 2, 13, 2, 37, 29, 13, 2, 13, 2, 5
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

5,1


COMMENTS

The sequence is undefined at n=4, as all the primitive roots are congruent to 3 mod 4.
Terms are not necessarily prime. For example, a(109) = 10.
a(prime(n)) = A229709(n).


LINKS

Eric M. Schmidt, Table of n, a(n) for n = 5..10000
Christopher Ambrose, On the Least Primitive Root Expressible as a Sum of Two Squares, INTEGERS, Electronic J. of Combinatorial Number Theory, Vol. 13, Paper A55, 2013.


EXAMPLE

The integer 5 = 2^2 + 1^2 has order 2 mod 12, the maximum, so a(12) = 5.


PROG

(Sage) def A229710(n) : m = Integers(n).unit_group_exponent(); return 0 if n==1 else next(i for i in PositiveIntegers() if mod(i, n).is_unit() and mod(i, n).multiplicative_order() == m and all(p%4 != 3 or e%2==0 for (p, e) in factor(i)))


CROSSREFS

Cf. A001481, A111076, A229708, A229709.
Sequence in context: A116698 A246900 A277086 * A240947 A023398 A186501
Adjacent sequences: A229707 A229708 A229709 * A229711 A229712 A229713


KEYWORD

nonn


AUTHOR

Eric M. Schmidt, Sep 27 2013


STATUS

approved



