New algorithms for modular inversion and representation by binary   quadratic forms arising from structure in the Euclidean algorithm
  We observe structure in the sequences of quotients and remainders of the Euclidean algorithm with two families of inputs. Analyzing the remainders, we obtain new algorithms for computing modular inverses and representating prime numbers by the binary quadratic form $x^2 + 3xy + y^2$. The Euclidean algorithm is commenced with inputs from one of the families, and the first remainder less than a predetermined size produces the modular inverse or representation. 
Christina Doran, Shen Lu, Barry R. Smith
math.NT