For the example 2, I feel that last data should be {4,1} instead of {4}.

n : 5

Number of ways = 6

Explanation: Following are the six ways we can express ‘n’ : {1,1,1,1,1}, {1,1,3}, {1,3,1}, {3,1,1},

{1,4}, {4}

n : 5

Number of ways = 6

Explanation: Following are the six ways we can express ‘n’ : {1,1,1,1,1}, {1,1,3}, {1,3,1}, {3,1,1},

{1,4}, {4}