Make a C program Theorem if n is composite not prime then n



Make a C++ program


Theorem: if n is composite (not prime), then n has an integer divisor n.
Proof:
Assume n is composite, then
There is an integer a, 1 < a < n such that a is a factor of n; then
There is an integer b > 1 such that n = ab; then
Prove: Either a n or b n. This is the “then” part of the theorem.
Proof of 4 by indirect proof:
Assume the negation of 4): a > n and b > n; then
ab > (n)2 ; then
ab > n, contradicting 3) (where ab = n).


Make a C++ program


Theorem: if n is composite (not prime), then n has an integer divisor n.
Proof:
Assume n is composite, then
There is an integer a, 1 < a < n such that a is a factor of n; then
There is an integer b > 1 such that n = ab; then
Prove: Either a n or b n. This is the “then” part of the theorem.
Proof of 4 by indirect proof:
Assume the negation of 4): a > n and b > n; then
ab > (n)2 ; then
ab > n, contradicting 3) (where ab = n).


Make a C++ program


Theorem: if n is composite (not prime), then n has an integer divisor n.
Proof:
Assume n is composite, then
There is an integer a, 1 < a < n such that a is a factor of n; then
There is an integer b > 1 such that n = ab; then
Prove: Either a n or b n. This is the “then” part of the theorem.
Proof of 4 by indirect proof:
Assume the negation of 4): a > n and b > n; then
ab > (n)2 ; then
ab > n, contradicting 3) (where ab = n).

Solution

**********************Theorem: if n is composite (not prime), then n has an integer divisor n.*****************

#include <iostream>
#include<math.h>
using namespace std;


int main()
{
int a, b, n, i, j, factor;
int m=0;
cout<<\"Enter number n: \";
cin>>n;
for(a = 2; a <n; a++){
for(b = 2; b <n; b++){

if(n%a == 0){
  
factor=a;
}
if (n == a * a){//if n=a*a then n>a
m=a; // if n is perfect square of a
}
if(n ==a*b){ //if n=a*b
  
i=a;
j=b;
  
}
  
  
}
  
}
if(m !=0){ //if number n is perfect square
  
if(m>=i){//for either a<= root of n

cout<<\"n has integer divisor <= root of n : \";
}
if(m >=j){//for or b<= root of n
  
cout<<\"n has integer divisor <= root of n : \";
  
}
}

return 0;
}

 Make a C++ program Theorem: if n is composite (not prime), then n has an integer divisor n. Proof: Assume n is composite, then There is an integer a, 1 < a
 Make a C++ program Theorem: if n is composite (not prime), then n has an integer divisor n. Proof: Assume n is composite, then There is an integer a, 1 < a

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site