function to calculate the coefficients of ( x - 1 ) ^ n - ( x ^ n - 1 ) with the help of Pascal 's triangle .
function coef ( $ n ) { $ c [ 0 ] = 1 ; for ( $ i = 0 ; $ i < $ n ; $ c [ 0 ] = - $ c [ 0 ] , $ i ++ ) { $ c [ 1 + $ i ] = 1 ; for ( $ j = $ i ; $ j > 0 ; $ j -- ) $ c [ $ j ] = $ c [ $ j - 1 ] - $ c [ $ j ] ; } }