SDA hm1 but maybe I should try the Ferma's algorythm.
Link to fermat algorythm