# Scalar Multiplication: LSB first. code in sagemath

Require k=(km-1,km-2,…,k0)2, km=1 Compute Q=kP Q=0, R=P For i=0 to m-1 If ki=1 then Q=Q+R End if R=2R End for kindly provide me sagemath code for above algorithm for prime field 37 and elliptic curve y^2=x^3+7x+25

What have you tried?

Please try to understand the python / sage syntax, and try own code. Even if the code does not work, we will try to make it closer and closer. There is really a big discrepancy between the time and the maturity level needed to understand elliptic curves and work (optimally) in related fields, either on the mathematical, or on the computer side of it, and the time needed to understand how loops work in python, then arrange the data in lists and "put things together".

Please use LaTeX code to display properly mathematical formulas, this is part of "selling the own product". For instance, typing in-line

produces: $k=(k_{m-1}, k_{m-2}, \dots, k_0)$ . (And explain it...)

There are situations when LaTeX and Askbot markup / markdown interfere, but...