title: Count Number Pairs N B N Gcd B B
signature: countNumberPairsNBNGcdBB(n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(double actual, double expected){
      return (actual - expected).abs() < 1e-09;
  }
  
  String driver(n, double expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          17, 
          58.47239288489289)
      }");
  
      print("TEST-1...${driver(
          72, 
          349.9783310569835)
      }");
  
      print("TEST-2...${driver(
          43, 
          187.0499406858786)
      }");
  
      print("TEST-3...${driver(
          55, 
          252.6486716559348)
      }");
  
      print("TEST-4...${driver(
          62, 
          291.1683590456309)
      }");
  
      print("TEST-5...${driver(
          22, 
          81.19789150478006)
      }");
  
      print("TEST-6...${driver(
          17, 
          58.47239288489289)
      }");
  
      print("TEST-7...${driver(
          68, 
          326.67596370158344)
      }");
  
      print("TEST-8...${driver(
          20, 
          71.95479314287363)
      }");
  
      print("TEST-9...${driver(
          29, 
          114.88796013002468)
      }");
  
      return 0;
  }
source_py: def count_number_pairs_n_b_n_gcd_b_b(n):
      k = n
      imin = 1
      ans = 0
      while (imin <= n):
          imax = (n / k)
          ans += (k * ((imax - imin) + 1))
          imin = (imax + 1)
          k = (n / imin)
      return ans
source_cpp: int count_number_pairs_n_b_n_gcd_b_b(int n) {
    int k = n;
    int imin = 1;
    int ans = 0;
    while ( imin <= n ) {
      int imax = n / k;
      ans += k * ( imax - imin + 1 );
      imin = imax + 1;
      k = n / imin;
    }
    return ans;
  }