This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A178153 #17 Sep 06 2025 03:07:25 %S A178153 1,0,1,3,0,0,3,3,0,3,0,0,3,5,0,9,0,3,7,0,5,9,0,0,0,5,9,0,0,5,15,0,9,0, %T A178153 7,0,3,11,0,15,0,13,0,0,9,9,7,15,0,0,15,0,21,0,13,0,11,0,0,9,0,9,19,0, %U A178153 0,9,0,15,0,0,19,9,0,9,17,0,0,0,0,27,0,21,0,15,15,0,0,0,7,21,25,7,27,9,21,0 %N A178153 Difference between the numbers of quadratic residues (mod p) less than p/2 and greater than p/2, where p=prime(n). %C A178153 When prime(n)=1 (mod 4), then a(n)=0. When prime(n)=3 (mod 4), then a(n)>0. When prime(n)=3 (mod 8) and prime(n)>3, then 3 divides a(n). See Borevich and Shafarevich. The nonzero terms of this sequence are closely related to A002143, the class number of primes p=3 (mod 4). %C A178153 Same as difference between the numbers of quadratic residues and nonresidues (mod p) less than p/2, where p=prime(n). - _Jonathan Sondow_, Oct 30 2011 %D A178153 Z. I. Borevich and I. R. Shafarevich, Number Theory, Academic Press, NY, 1966, p. 346. %D A178153 H. Davenport, Multiplicative Number Theory, Graduate Texts in Math. 74, 2nd ed., Springer, 1980, p. 51. %H A178153 R. J. Mathar, <a href="/A178153/b178153.txt">Table of n, a(n) for n = 2..2066</a> %H A178153 MathOverflow, <a href="http://mathoverflow.net/questions/25263">Most squares in the first half-interval</a> %F A178153 a(n) = A178151(n) - A178152(n). %F A178153 a(n) = Sum_{j=1..(p-1)/2} (j|p), where p = prime(n) and (j|p) = +-1 is the Legendre symbol. - _Jonathan Sondow_, Oct 30 2011 %e A178153 The quadratic residues of 19, the 8th prime, are 1, 4, 5, 6, 7, 9, 11, 16, 17. Hence a(8)=6-3=3. %p A178153 A178153 := proc(n) %p A178153 local r,a,p; %p A178153 p := ithprime(n) ; %p A178153 a := 0 ; %p A178153 for r from 1 to p/2 do %p A178153 if numtheory[legendre](r,p) =1 then %p A178153 a := a+1 ; %p A178153 end if; %p A178153 end do: %p A178153 for r from ceil(p/2) to p-1 do %p A178153 if numtheory[legendre](r,p) =1 then %p A178153 a := a-1 ; %p A178153 end if; %p A178153 end do: %p A178153 a; %p A178153 end proc: # _R. J. Mathar_, Feb 10 2017 %t A178153 Table[p=Prime[n]; Length[Select[Range[(p-1)/2], JacobiSymbol[ #,p]==1&]] - Length[Select[Range[(p+1)/2,p-1], JacobiSymbol[ #,p]==1&]], {n,2,100}] %t A178153 Table[p = Prime[n]; Sum[ JacobiSymbol[a, p], {a, 1, (p-1)/2}], {n, 2, 100}] (* _Jonathan Sondow_, Oct 30 2011 *) %Y A178153 Cf. A002143, A178154 (without the zero terms). %K A178153 nonn,changed %O A178153 2,4 %A A178153 _T. D. Noe_, May 21 2010