Defined
prime numbers, also known prime number. NATURAL a number larger than 1, except 1 and itself, but not divisible by the number called and other natural prime number; else called composite.
Properties
prime number having a number of unique characteristics:
(1) Number of about only two primes p: 1 and p.
(2) Elementary basic mathematical theorem: any of a natural number greater than 1, per se or is a prime number or the product can be decomposed into the sum of several quality, and this decomposition is only.
The number (three) of prime number is unlimited.
(4) the number of prime numbers formula is diminished function.
(E) If n is a positive integer, between at least one prime number.
(6) If n is a positive integer equal to or greater than 2, at least between a prime to n.
(7) if p is a prime number not exceeding the maximum number of n-mass (), then.
(8) greater than all the prime numbers 10, only 1,3,7,9 digit
Prime density official
according to
Constructor
A is a constant and
The properties of polynomial 1-1
As a function
The index
Too:
1-2
When n is a prime number or 1,
Equal to 1, when n is a composite number
Obtain prime density official
1 defined in the formula is a prime number.
code show as below:
def Sushu(su):
su = int(su)
if su <= 1:
exit("参数错误,请重新输入")
i = 2
while i * i <= su:
if su % i == 0:
print "%d不是素数" % su,exit()
i += 1
print "%d是素数" %su
print Sushu(4)
Output effect