I suck at Algorithms! That's what i though when someone asks me can i write and algorithm for something. But for several years are make money and have fun with code, and a friend shared this link http://projecteuler.net
first time i saw it 1-2 years ago i thought that i must write it on paper and failed. But now i saw i must do it with code and i will post how i found the solutions.