I am getting the right output for n = 1,2,3. But still it is not passing. Why?

Help will be appreciated.