answersLogoWhite

0

Still curious? Ask our experts.

Chat with our AI personalities

BeauBeau
You're doing better than you think!
Chat with Beau
ReneRene
Change my mind. I dare you.
Chat with Rene
JudyJudy
Simplicity is my specialty.
Chat with Judy

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++; }