answersLogoWhite

0


Best Answer
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is 5 a prime num ber?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

Is 107 a prime or composite num ber?

107 is a prime number. A prime number has only 2 factors which are 1 and itself. Composite numbers are everything else except 1 and 0. 1 and 0 are neither prime, nor composite.


What is prime num between 2 10?

They are: 2 3 5 and 7


Write a unix shell program to print the prime numbers?

i=2 rem=1 echo "Enter a number" read num if [ $num -lt 2 ] then echo "$num is not prime" exit 0 fi while [ $i -le `expr $num / 2` -a $rem -ne 0 ] do rem=`expr $num % $i` i=`expr $i + 1` done if [ $rem -ne 0 ] then echo "$num is prime" else echo "$num is not prime" fi


How do you write a c program to find prime numbers between 1 to 10000 using functions?

You need two utility functions. The first determines if a given number is prime or not. The second finds the next prime after a given number. The following function can be used to determine if a given integer is prime: bool is_prime (const unsigned num) { if (num<2) return false; if (0==(num%2)) return num==2; unsigned max_factor = (unsigned) sqrt ((double) num) + 1; unsigned factor; for (factor=3; factor<max_factor; ++factor) if (0==(num%factor)) return false; return true; } The following function can be used to determine the next prime after the given integer: unsigned next_prime (unsigned num) { while (!is_prime (++num)); return num; } Now you can print a series of primes using the following: int main (void) { unsigned num=1; while (num<10000) { num = next_prime (num); printf ("%d is prime\n", num); } return 0; }


Write a method which displays first 50 prime numbers?

Implement an isPrime method int JAVA with this: int count = 0, num = 2; while(count < 50) { if(isPrime(num)) count++; num++; }

Related questions

Mark the stress on the word number?

NUM-ber The stress is on NUM.


What is willow smiths num ber?

4045635459


How many syllables are in 'a number'?

There are 3 syllables. A - num-ber.


How many syllables does number have?

There are two syllables. Num-ber.


Is 107 a prime or composite num ber?

107 is a prime number. A prime number has only 2 factors which are 1 and itself. Composite numbers are everything else except 1 and 0. 1 and 0 are neither prime, nor composite.


What is the least common multiple num ber 12 and 20?

The LCM is: 60


What is 60 percent as a nuM ber?

60% or 60/100 or 6/10 or 0.60


What is prime num between 2 10?

They are: 2 3 5 and 7


How do you separate the syllable in the word number?

There are two syllables divided like so: num-ber.


How do you write a program that prints out the first 100 prime numbers using OOP?

You do not need OOP for this because the first 100 prime numbers are all integral types. All you need is a function to determine if a given integral is prime or not, and another to find the next prime after a given integral: bool is_prime (const unsigned int num) { unsigned factor, max_factor; /* anything less than 2 is non-prime */ if (num<2) return false; /* 2 is the only even prime */ if (!(num%2) return num==2; /* determine largest potential factor of num (square root of num)*/ max_factor = sqrt (num); /* test each odd factor from 3 onwards */ for (factor=3; factor<=max_factor; factor+=2) { if (!(num%factor)) return false; /* num is non-prime */ } return true; /* the number is prime */ } unsigned next_prime (unsigned int num) { /* increment num until num is prime */ while (!is_prime (++num)); return num; } /* test the functions */ int main (void) { unsigned num, count; count=0; num=0; printf ("Printing the first 100 prime numbers:\n"); while (count<100) { num=next_prime (num); printf ("%d is prime\n", num); ++count; } return 0; }


Is 39 an prime num?

No.


Write a unix shell program to print the prime numbers?

i=2 rem=1 echo "Enter a number" read num if [ $num -lt 2 ] then echo "$num is not prime" exit 0 fi while [ $i -le `expr $num / 2` -a $rem -ne 0 ] do rem=`expr $num % $i` i=`expr $i + 1` done if [ $rem -ne 0 ] then echo "$num is prime" else echo "$num is not prime" fi