Find next power by multiplying N with current power
static void nextPower ( int N , ref List < int > power ) { int carry = 0 ; for ( int i = 0 ; i < power . Count ; i ++ ) { int prod = ( power [ i ] * N ) + carry ;