OFFSET
5,1
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 5..10000
EXAMPLE
The squares modulo 5 are 1 and 4, therefore a(5) = 4.
Modulo 6 the squares are 1, 3 and 4 which makes a(6) = 3.
a(7) = 2 since 2 == 3^2 (mod 7).
MAPLE
f:= proc(n) uses numtheory; if quadres(2, n)=1 then 2 elif quadres(3, n)=1 then 3 else 4 fi end proc:
map(f, [$5..100]); # Robert Israel, Sep 15 2020
MATHEMATICA
qrQ[m_, n_] := Module[{k}, Reduce[Mod[m-k^2, n]==0, k, Integers] =!= False];
a[n_] := If[qrQ[2, n], 2, If[qrQ[3, n], 3, 4]];
a /@ Range[5, 100] (* Jean-François Alcover, Oct 25 2020 *)
PROG
(PARI) a(n) = if(issquare(Mod(2, n)), 2, issquare(Mod(3, n)), 3, 4)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Peter Schorn, May 07 2020
STATUS
approved