Gnomon algorithm function

From Gnomon Chronicles