started problem 12, need to heavily optimize. Perhaps use N*(N+1)/2