program logic of printing the prime numbers

前端 未结 7 568
别那么骄傲
别那么骄傲 2021-01-25 22:15

Can any body help to understand this java program?

It just prints prime numbers, as you enter how many you want and it works well.

class PrimeNumbers
{           


        
7条回答
  •  南方客
    南方客 (楼主)
    2021-01-25 22:36

    If I'm right there is a theory in math, saying that nearly all prime numbers can be determined when checking numbers from 2 to square root of n instead of checking all numbers from 2 to n oder 2 to n/2.

提交回复
热议问题