Project euler N 31 | the dumb way