Use the following function to determine if a whole number is prime, including negative values:
bool isprime(int p)
{
if(p<0)
p*=(-1); // convert to positive integer
if( p<2 ( p>2 && p&1==0 ))
return( false );
int max = (int)sqrt((double) p)+1;
for( int i=3; i<=max; i+=2 )
if( p%i==0 )
return( false );
return( true );
}
#include <iostream.h> main() { int a; cout<<"enter a number : "; cin>>a; cout<<endl; if (a%2-1) cout<<"it is a prime number"; else cout<<"it is not a prime number" return 0; } ------------------------------------------ output: enter a number : 30 it is a not a prime number
a prime number is a number that you can plus by one
47 + 7
A prime plus another prime is at the very least going to be an even number since all primes (with the exception of 2) are odd.
No. it's not a prime number when x = 40, 41, 81,82 ...
No. (5x3x17) + 17 =255 + 17 =272 (This is not prime.)
No. The number 38,482 is composite.
n = 5.
yes
It is: 3 plus 97 = 100
It would always be a natural number.
22 + 3 = 7 Since 2 is the only even prime number, this is the only number for which this holds true.