A prime number is any number divisible only by one and itself . write aprograme to compute all the prime numbers less than 2000. One way to generate prime numbers is to create an array of Boolean values that are true for all prime numbers . false otherwise. Initially set all the array entries to true. then for avery number from 2 to 1000, set the array locations indexed byy multiples of the number (but not the number itself) to false. When done, output all numbers whose array location is true.these will by prime numbers.
0 comments:
Post a Comment