A130290 Number of nonzero quadratic residues modulo the n-th prime.
1, 1, 2, 3, 5, 6, 8, 9, 11, 14, 15, 18, 20, 21, 23, 26, 29, 30, 33, 35, 36, 39, 41, 44, 48, 50, 51, 53, 54, 56, 63, 65, 68, 69, 74, 75, 78, 81, 83, 86, 89, 90, 95, 96, 98, 99, 105, 111, 113, 114, 116, 119, 120, 125, 128, 131, 134, 135, 138, 140, 141, 146, 153, 155, 156, 158
Offset: 1
Examples
a(1)=1 since the only nonzero element of Z/2Z equals its square. a(3)=2 since 1=1^2=(-1)^2 and 4=2^2=(-2)^2 are the only nonzero squares in Z/5Z. a(1000000) = 7742931 = (prime(1000000)-1)/2.
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..1000
- Eric Weisstein's World of Mathematics, Quadratic Residue
- Wikipedia, Quadratic Residue
Crossrefs
Essentially the same as A005097.
Cf. A102781 (Number of even numbers less than the n-th prime), A063987 (quadratic residues modulo the n-th prime), A006254 (Numbers n such that 2n-1 is prime), A111333 (Number of odd numbers <= n-th prime), A000040 (prime numbers), A130291.
Appears in A217983. - Johannes W. Meijer, Oct 25 2012
Programs
-
Magma
[Floor((NthPrime(n))/2): n in [1..60]]; // Vincenzo Librandi, Jan 16 2013
-
Maple
A130290 := proc(n): if n =1 then 1 else (A000040(n)-1)/2 fi: end: A000040 := proc(n): ithprime(n) end: seq(A130290(n), n=1..55); # Johannes W. Meijer, Oct 25 2012
-
Mathematica
Quotient[Prime[Range[66]], 2] (* Vladimir Joseph Stephan Orlovsky, Sep 20 2008 *)
-
PARI
A130290(n) = prime(n)>>1
-
Python
from sympy import prime def A130290(n): return prime(n)//2 # Chai Wah Wu, Jun 04 2022
Comments