answersLogoWhite

0


Best Answer

echo enter a range

read rng

echo 2

j=3

while test $j -le $rng

do

i=2

x=`expr $j - 1`

while test $i -le $x

do

if [ `expr $j % $i` -ne 0 ]

then

i=`expr $i + 1`

else

break

fi

done

if [ $i -eq $j ]

then

echo $j

fi

j=`expr $j + 1`

done

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a shell Program to generate the first 25 prime numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

Shell program to generate the prime numbers betwee 1 to 50?

2,3,5,7,9,11,13,17,19,23,29,31,37,39,41,43,47,49


Shell program to generate prime number between 1 and 50?

There are several shell programs available for download on the Internet that will generate prime numbers. The best way to find a prime number is through calculation, however.


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


What is the formula of finding prime numbers from 500-0?

There is no formula that will generate all the prime numbers less than or equal to 500. Perhaps the "next best thing" is that there are some formulas that will generate prime numbers for certain values that are plugged in to the formula, but not necessarily all the prime numbers. For example, the formula n2 - n + 41 will generate prime numbers for all values of n from 0 to 40, but not for all values greater than or equal to 41. But even for values of n that are less than or equal to 40, while the formula will result in a prime number, it doesn't generate all the prime numbers. The first few prime numbers generated by this formula (for n = 0, 1, 2, 3, 4, and 5) are 41, 41, 43, 47, 53, and 61. But many prime numbers get "skipped over" by using this, or any other, formula.


What are two prime numbers that would generate 400?

There are no two prime numbers that would generate 400. The prime factorization of 400 is 2^4 * 5^2, which means it can be expressed as the product of two powers of primes, but not as the product of two distinct prime numbers.

Related questions

Shell program to generate the prime numbers betwee 1 to 50?

2,3,5,7,9,11,13,17,19,23,29,31,37,39,41,43,47,49


What is a C program to generate prime no?

not sure of the exact syntax but its quite hard to generate them, but you can go through a list of numbers, that could be 0-10000000 say, and check if it is prime by dividing it by all the numbers that are smaller than it


Shell program to generate prime number between 1 and 50?

There are several shell programs available for download on the Internet that will generate prime numbers. The best way to find a prime number is through calculation, however.


How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


Which relies on prime numbers to generate keys?

Data encryption.


What is the formula of finding prime numbers from 500-0?

There is no formula that will generate all the prime numbers less than or equal to 500. Perhaps the "next best thing" is that there are some formulas that will generate prime numbers for certain values that are plugged in to the formula, but not necessarily all the prime numbers. For example, the formula n2 - n + 41 will generate prime numbers for all values of n from 0 to 40, but not for all values greater than or equal to 41. But even for values of n that are less than or equal to 40, while the formula will result in a prime number, it doesn't generate all the prime numbers. The first few prime numbers generated by this formula (for n = 0, 1, 2, 3, 4, and 5) are 41, 41, 43, 47, 53, and 61. But many prime numbers get "skipped over" by using this, or any other, formula.


What are two prime numbers that would generate 400?

There are no two prime numbers that would generate 400. The prime factorization of 400 is 2^4 * 5^2, which means it can be expressed as the product of two powers of primes, but not as the product of two distinct prime numbers.


Print first ten prime numbers in c?

// simple program to generate first ten prime numbers #include<stdio.h> #include<conio.h> void main() { int c,i,j,n; clrscr(); for(i=2;i<30;i++) { c=0; for(j=2;j<i;j++) { if(i%j==0) {c=c+1; } } if(c==0) printf("%d",i); } getch(); }


With a given big integer number which is the product of two prime numbers how do you find them?

First write a program to generate the prime number. After one prime number was generated, divide the big int number by the prime number. If the remainder is zero then quotient is the second prime number ( also it is important to check whether the quotient is prime number or not because sometimes you will get wrong answer). Repeat the process until you get the result.


Write a program to print first 100 alternative prime numbers?

This would require some computer knowledge. It can make it easier to find out the prime numbers without figuring it out in your head.


How do you write a VBnet program to find the prime numbers between 100 to 200?

VBnet program to find the prime numbers between 100 to 200?


Program for print prime all number from 1 to 100 in foxpro?

Prime numbers are numbers that are only divisible by themselves and the number 1. You can write a program to print all prime numbers from 1 to 100 in FoxPro.