Number of compositions of a natural number | javascript program to find the total number of compositions of a natural number ; Return 2 raised to power ( n - 1 ) ; Driver Code
function countCompositions ( n ) { return 1 << ( n - 1 ) ; } var n = 4 ; document . write ( countCompositions ( n ) ) ;