%I M0418 N0160 #27 Dec 22 2021 00:09:26
%S 1,1,1,2,3,2,2,4,4,4,4,4,3,5,4,3,5,5,6,6,4,6,7,4,4,7,7,6,5,5,7,8,6,5,
%T 4,7,6,6,6,6,6,6,6,4,7,6,7,7,7,5,6,6,6,7,6,7,8,7,10,6,9,9,7,10,5,5,8,
%U 5,8,6,6,8,9,6,8,8,8,5,7,6,8,7,6,7,10,8,8,5,8,8,11,12,8,8,10,8,9,8,10,7,9,9,10,10,7,6,9
%N Consecutive quadratic residues mod p: a(n) is the maximal number of positive reduced quadratic residues which appear consecutively for n-th prime.
%C When prime(n) == 3 (mod 4), then a(n) = A002308(n). - _T. D. Noe_, Apr 03 2007
%C A048280(n) is defined similarly, except that reduced quadratic residues equal to 0 are also included. - _Jonathan Sondow_, Jul 20 2014
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H T. D. Noe, <a href="/A002307/b002307.txt">Table of n, a(n) for n = 1..10000</a>
%H A. A. Bennett, <a href="http://dx.doi.org/10.1090/S0002-9904-1926-04211-7">Consecutive quadratic residues</a>, Bull. Amer. Math. Soc., 32 (1926), 283-284.
%F a(n) <= A048280(n) < 2*sqrt(prime(n)). - _Jonathan Sondow_, Jul 20 2014
%t f[l_, a_] := Module[{A = Split[l], B}, B = Last[ Sort[ Cases[A, x : {a ..} :> {Length[x], Position[A, x][[1, 1]]}]]]; {First[B], Length[ Flatten[ Take[A, Last[B] - 1]]] + 1}]; g[n_] := f[ JacobiSymbol[ Range[ Prime[n] - 1], Prime[n]], 1][[1]]; Table[ g[n], {n, 2, 102}] (* _Robert G. Wilson v_, Jul 28 2004 *)
%Y Cf. A002308, A048280, A097159.
%K nonn,easy,nice
%O 1,4
%A _N. J. A. Sloane_
%E More terms from _David W. Wilson_
|