Function to calculate smallest prime factor of N .
void calculate_SPF ( ) { for ( lli i = 0 ; i <= MAX ; i ++ ) spf [ i ] = i ; for ( lli i = 4 ; i <= MAX ; i += 2 ) spf [ i ] = 2 ; for ( lli i = 3 ; i * i <= MAX ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j <= MAX ; j += i )