This is a creation in Article, where the information may have evolved or changed.
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~
Examination problem
Prime number, also known as Prime number, has an infinite number. A prime number is defined as the number of natural numbers greater than 1, except that 1 and itself no longer have other factors known as prime numbers.
Determine how many primes are in between 101-200 and output all primes.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Analysis
Program Analysis: The method of judging primes: to remove 2 to sqrt (this number) with a number, if divisible, indicates that the number is not a prime, and vice versa is a prime.
In the general domain, the positive integer n, if all integers between 2 and square root n are removed, are not divisible, then n is prime.
A prime number greater than or equal to 2 cannot be divisible by its own and 1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Program
Func isprime (value int) bool { if value <= 3 { return value >= 2 } if value%2 = = 0 | | value%3 = = 0 { return False } For I: = 5; I*i <= value; i + = 6 { if value%i = = 0 | | value% (i+2) = = 0 { return false } } return True}