Question: Please use c++ to solve it. Base case functionality: 1. If the number itself is prime (i.e., it cannot be factorized) then just print Is
Please use c++ to solve it.



Base case functionality: 1. If the number itself is prime (i.e., it cannot be factorized) then just print Is already prime as shown in the first sample output below. 2. If the number is not prime, then print the two factors with one of them being be the first smallest factor. In addition, indicate if the factors are prime by printing (prime)" after the factors. See sample output further below for details. Additional functionality: Multithread the program such that each number is processed by a separate thread. That is, if you are given k command-line arguments, you should use k threads. It would be easiest to store the integer factorization result for each number in a separate entry in a std::vector<:string> (ensure you initially create k entries to store results from each thread) and print the results after all the threads have joined. Sample input and outputs Note: For base case functionality only 1 command-line argument is expected to be processed. Base case #1: $ ./hw6 78167 78167: Is already prime. Base case #2: $ ./hw6 18446744073709551614 18446744073709551614 = 2 (prime) * 9223372036854775807 Base case #3: $ ./hw6 36679527361 36679527361 = 191519 (prime) 191519 (prime) Additional functionality: $ ./hw6 78167 462403710681259 18446744073709551614 37118488909 11141099973001 15463387808083 78167: Is already prime. 462403710681259 = 78167 (prime) 5915587277 (prime) 18446744073709551614 = 2 (prime) * 9223372036854775807 37118488909 - 191519 (prime) 193811 (prime) 11141099973001 - 1114111 (prime) 9999991 (prime) 15463387808083 - 1878781 (prime) * 8230543 (prime)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
