Returns largest power of B that divides N !
static int largestPowerOfB ( int N , int B ) { Vector < pair > vec = new Vector < pair > ( ) ; vec = primeFactorsofB ( B ) ; int ans = Integer . MAX_VALUE ; for ( int i = 0 ; i < vec . size ( ) ; i ++ )