solved euler28 with very unclean code, could be minimized much further.