title: Sum Largest Prime Factor Number Less Equal N
signature: sumLargestPrimeFactorNumberLessEqualN(n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(n, int 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(
          6, 
          15)
      }");
  
      print("TEST-1...${driver(
          35, 
          291)
      }");
  
      print("TEST-2...${driver(
          87, 
          1554)
      }");
  
      print("TEST-3...${driver(
          91, 
          1672)
      }");
  
      print("TEST-4...${driver(
          63, 
          875)
      }");
  
      print("TEST-5...${driver(
          11, 
          43)
      }");
  
      print("TEST-6...${driver(
          66, 
          901)
      }");
  
      print("TEST-7...${driver(
          17, 
          90)
      }");
  
      print("TEST-8...${driver(
          92, 
          1695)
      }");
  
      print("TEST-9...${driver(
          81, 
          1334)
      }");
  
      return 0;
  }
source_py: def sum_largest_prime_factor_number_less_equal_n(n):
      prime = ([0] * (n + 1))
      sum = 0
      max = int((n / 2))
      for p in range(2, (max + 1)):
          if (prime[p] == 0):
              for i in range((p * 2), (n + 1), p):
                  prime[i] = p
      for p in range(2, (n + 1)):
          if prime[p]:
              sum += prime[p]
          else:
              sum += p
      return sum
source_cpp: int sum_largest_prime_factor_number_less_equal_n(int n) {
    int prime [ n + 1 ], sum = 0;
    memset ( prime, 0, sizeof ( prime ) );
    int max = n / 2;
    for ( int p = 2;
    p <= max;
    p ++ ) {
      if ( prime [ p ] == 0 ) {
        for ( int i = p * 2;
        i <= n;
        i += p ) prime [ i ] = p;
      }
    }
    for ( int p = 2;
    p <= n;
    p ++ ) {
      if ( prime [ p ] ) sum += prime [ p ];
      else sum += p;
    }
    return sum;
  }