login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A178151 The number of quadratic residues (mod p) less than p/2, where p=prime(n). 3
1, 1, 2, 4, 3, 4, 6, 7, 7, 9, 9, 10, 12, 14, 13, 19, 15, 18, 21, 18, 22, 25, 22, 24, 25, 28, 31, 27, 28, 34, 40, 34, 39, 37, 41, 39, 42, 47, 43, 52, 45, 54, 48, 49, 54, 57, 59, 64, 57, 58, 67, 60, 73, 64, 72, 67, 73, 69, 70, 75, 73, 81, 87, 78, 79, 87, 84, 94, 87, 88, 99, 96, 93 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,3
COMMENTS
Sequence A063987 lists the quadratic residues (mod p) for each prime p. When p=1 (mod 4), there are an equal number of quadratic residues less than p/2 and greater than p/2. When p=3 (mod 4), there are always more quadratic residues less than p/2 than greater than p/2.
LINKS
EXAMPLE
The quadratic residues of 19, the 8th prime, are 1, 4, 5, 6, 7, 9, 11, 16, 17. Six of these are less than 19/2. Hence a(8)=6.
MAPLE
A178151 := proc(n)
local r, a, p;
p := ithprime(n) ;
a := 0 ;
for r from 1 to p/2 do
if numtheory[legendre](r, p) =1 then
a := a+1 ;
end if;
end do:
a;
end proc: # R. J. Mathar, Feb 10 2017
MATHEMATICA
Table[p=Prime[n]; Length[Select[Range[(p-1)/2], JacobiSymbol[ #, p]==1&]], {n, 2, 100}]
CROSSREFS
Sequence in context: A224714 A089169 A291563 * A087794 A050514 A229047
KEYWORD
nonn
AUTHOR
T. D. Noe, May 21 2010
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 11:07 EDT 2024. Contains 371905 sequences. (Running on oeis4.)