Math, asked by Niranjana3288, 2 months ago

write the sequence of prime numbers. check whether it is an AS​

Answers

Answered by mominashiraz2007
1

Answer:

Step-by-step explanation:

I'm not sure what modulus functions you want to avoid, but if you only want to print the primes upto the storage limit of your ram, see if this method suggests anything.

Suppose the job of generating all the primes less than, say the integer  N2 , was given to the military, here's how they would go about it!

They would line up a bunch of  N  recruits and order them to march in tandem, with the sergeant-major yelling the question 'Prime?' to them at every step.

The  1 'st recruit would be ordered to yell out NO at every  2 nd step. The  2 nd recruit is to yell NO at every  3 rd step. The  3 rd recruit is to yell NO at every  4 th step, and so on (i.e., the  N 'th recruit must yell NO at every ( N+1 )th step).

If you make a diagram representing such a parade on paper, you will see that every now and then there is a step, say  k , when no recruit in the marching line yells NO.

If such a step  k  (i.e., when no recruit yells NO) is less than  N2 , then that step is a prime number.

Why is  k  a prime if no recruit yells NO?

Because if the  n 'th recruit had yelled NO at the  k 'th step, then  k  would have been a multiple of  n , and so not a prime.

Now if, instead of imagining a line of only  N  recruits, we were to imagine an endless line of recruits, then their endless parade would hypothetically generate all the primes.

See Appendix II(A), fig.6, p.23 and Appendix II(B), fig.7, p.24 of the following paper for a graphical display of the above algorithm:

 

That is the theory. However, I suspect that the fastest algorithm---based on the above---for generating only the primes endlessly is the COMPACT.

Answered by vimalkumarvishwakarm
1

Answer:

The first 25 prime numbers (all the prime numbers less than 100) are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97 (sequence A000040 in the OEIS). ... Therefore, every prime number other than 2 is an odd number, and is called an odd prime.

Similar questions