def d(): for x in filter(lambda x: x%2==1, filter(func.is_prime, xrange(1, 1000))): res = func.quadraticResidues(x) A = sum(res[0]) B = sum(res[1]) if A == B: print 'A:', A, 'p-->', x, 'p mod 4', x%4
# quadratic residues modulo 19 # 1, 4, 5, 6, 7, 9, 11, 16, 17 # quadratic nonresidues modulo 19 # 2, 3, 8, 10, 12, 13, 14, 15, 18 import func if __name__ == '__main__': print func.quadraticResidues(19)
def iss(m, n): erci, nerci = func.quadraticResidues(n) return m in erci
def b(): for x in filter(lambda x: x%2==1, filter(func.is_prime, xrange(1, 20))): res = func.quadraticResidues(x) print 'A:', sum(res[0]), 'B:', sum(res[1]), 'p-->', x, 'A+B-->', sum(res[0]) + sum(res[1])
def a(): for x in filter(lambda x: x%2==1, filter(func.is_prime, xrange(1, 20))): print func.quadraticResidues(x), '-->', x