title: Count Number Pairs N B N Gcd B B
signature: double countNumberPairsNBNGcdBB(int n) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(double actual, double expected){
      return abs(actual - expected) < 1e-09;
  }
  
  string driver(int n, double expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver(17, 58.47239288489289); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver(72, 349.9783310569835); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver(43, 187.0499406858786); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver(55, 252.6486716559348); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver(62, 291.1683590456309); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver(22, 81.19789150478006); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver(17, 58.47239288489289); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver(68, 326.67596370158344); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver(20, 71.95479314287363); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver(29, 114.88796013002468); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      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;
  }