Project Euler problems (TSQL)