A080114 Odd primes p for which all sums Sum_{j=1..u} L(j/p) (with u ranging from 1 to (p-1)/2) are nonnegative, where L(j/p) is Legendre symbol of j and p.
3, 5, 7, 11, 13, 23, 31, 37, 47, 59, 71, 79, 83, 103, 131, 151, 167, 191, 199, 239, 251, 263, 271, 311, 359, 383, 419, 431, 439, 479, 503, 563, 599, 607, 647, 659, 719, 743, 751, 839, 863, 887, 911, 919, 971, 983, 991, 1031, 1039, 1063, 1091, 1103, 1151, 1223
Offset: 1
Keywords
Links
- Michel Marcus, Table of n, a(n) for n = 1..430
- Antti Karttunen, Illustration of Legendre's candelabras
- Eric Weisstein's World of Mathematics, Legendre Symbol
- Wikipedia, Legendre symbol
Crossrefs
Programs
-
Maple
with(numtheory); # For ithprime and legendre. A080114 := n -> ithprime(A080112(n)); A080114v2 := proc(upto_n) local j,a,p,i,s; a := []; for i from 2 to upto_n do p := ithprime(i); s := 0; for j from 1 to (p-1)/2 do s := s + legendre(j,p); if(s < 0) then break; fi; od; if(s >= 0) then a := [op(a),p]; fi; od; RETURN(a); end;
-
Mathematica
s[p_, u_] := Sum[JacobiSymbol[j, p], {j, 1, u}]; Select[Prime[Range[2, 200] ], (p = #; AllTrue[Range[(p - 1)/2], s[p, #] >= 0 &]) &] (* Jean-François Alcover, Mar 04 2016 *)
-
PARI
isok(p) = if (isprime(p) && (p>2), for (u=1, (p-1)/2, if (sum(j=1, u, kronecker(j, p)) < 0, return(0));); return(1);); \\ Michel Marcus, Sep 20 2022
-
Sage
def A080114_list(n) : a = [] for i in (2..n) : s = 0 p = nth_prime(i) for j in (1..(p-1)/2) : s += legendre_symbol(j, p) if s < 0 : break if s >= 0 : a.append(p) return a A080114_list(200) # Peter Luschny, Aug 08 2012
Comments