The solution is in reaching to n faster


#1

because the limit is upto n and to reach to it faster multiplication will help .