In [1]:
get_ipython().ast_node_interactivity = 'all'
import matplotlib.pyplot as plt
from collections import namedtuple
In [6]:
BYTES = 1

Curve = namedtuple("Curve", "mult add mod")

# Curve parameters
curve = Curve(0, 500, 7919)

def point_on_curve(x, y, curve):
    return (y * y) % curve.mod == ((x * x * x) + (curve.mult * x) + curve.add) % curve.mod

xs = []
ys = []

for x in range(curve.mod):
    for y in range(curve.mod):
        if point_on_curve(x, y, curve):
            xs.append(x)
            ys.append(y)

def point_add(x1, y1, x2, y2):
    s = 3 * (x1 * x1) // (2 * y1)
    
    x = (s*s) - (2 * x1)
    y = y1 + s * (x - x1)
    return x, y

def point_mult_int(point, k):
    x, y = point
    for _ in range(k):
        x, y = point_add(x, y, x, y)
    return x, y

G = (15, 13)
    

plt.scatter(xs, ys)
Out [6]:
Out:
<Figure size 432x288 with 1 Axes>