It  wasnt that difficult after doing a research of the Euclids algorithm

http://www.cut-the-knot.org/blue/Euclid.shtml

here is my code

https://github.com/fernandazm/WSQS/blob/master/WSQ%2012

CC BY 4.0 WSQ12 by fernandazm is licensed under a Creative Commons Attribution 4.0 International License.