Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Data Mining - Computer Science I\'m looking for C or C++ program to test below E

ID: 665518 • Letter: D

Question

Data Mining - Computer Science

I'm looking for C or C++ program to test below Equation A & B. Input Value X is from 1 to 100 & seeing if the resulting numbers are prime or not. I want program to print X value ( Input ), Z value ( based on the X ) & mention if Z value is Prime Number or not

Equation A = > Z = 2*x**2 + 29

Equation B = > Z = x**4 + 29*x**2 + 101

Also, I want to know recall and precision for each detector (A and B) based on the input of the first 100 integers

Formula for Recall & Precision , Follow below link

https://en.wikipedia.org/wiki/Precision_and_recall

http://www.kdnuggets.com/faq/precision-recall.html

Explanation / Answer

Equation A:

#include <iostream>
using namespace std;

int main()
{
int x, z, i, flag=0;
cout << "Enter the value for x from 1 to 100: ";
cin >> x;
z = 2*x*2 + 29;
for(i=2;i<=z/2;++i)
{
      if(z%i==0)
      {
          flag=1;
          break;
      }
}
cout<<"The x value is : "<< x << endl;
cout<<"The corresponding z value is : "<< z << endl;
if (flag==0)
      cout << "Z value is prime number";
else
      cout << "Z value is not a prime number";
return 0;
}

Equation B:

#include <iostream>
using namespace std;

int main()
{
int x, z, i, flag=0;
cout << "Enter the value for x from 1 to 100: ";
cin >> x;
z = x*4 + 29*x*2 + 101;
for(i=2;i<=z/2;++i)
{
      if(z%i==0)
      {
          flag=1;
          break;
      }
}
cout<<"The x value is : "<< x << endl;
cout<<"The corresponding z value is : "<< z << endl;
if (flag==0)
      cout << "Z value is prime number";
else
      cout << "Z value is not a prime number";
return 0;
}