function to convert num to base 6
static int baseconversion ( int [ ] arr , int num , int bas ) { int i = 0 , rem ; if ( num == 0 ) { return 0 ; } while ( num > 0 ) { rem = num % bas ; arr [ i ++ ] = rem ; num /= bas ; } return i ; }