Hi everyone,

I'm trying to find the points that satisfy the equation
y^2=(x^3)+ (4*x) + 4 (mod 5)

from the book i know im suppose to get
x=0 y=2
x=0 y=3
x=2 y=0
x=4 y=2
x=4 y=3

so far i haven't been luck in getting anything
any help is appericated

def findpoints(b,c,p):
	i=40
	x=0
	y=0
	while(y<i):
		while(x<i):
			if(pow(y,2)%p==(pow(x,3)+(b*x)+c)):
				print v1,v2
			x=x+1
		y=y+1
	return

findpoints(4,4,5)

kind of messed up the code,

def findpoints(b,c,p):
	i=40
	y=0
	while(y<i):
		x=0
		while(x<i):
			if(pow(y,2)%p==(pow(x,3)+(b*x)+c)):
				print x,y
			x=x+1
		y=y+1
	return

Shouldn't that be:
if pow(y, 2) == (pow(x, 3)+(b*x)+(c % p)):

It also pays to test-print some interim results.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.