first algorithm put into tex