1430 prime number determination, 1430 Prime Number

Source: Internet
Author: User

1430 prime number determination, 1430 Prime Number
1430 prime number determination

 

Time Limit: 1 s space limit: 1000 KB title level: Bronze QuestionDescription Description

Prime Number.In a natural number greater than 1, except for 1 and the integer itself, it cannot be divisible by other natural numbers..

Prime numbers play an important role in number theory. A number larger than 1 but not a prime number is called a union number. 1 and 0 are both non-prime numbers and non-composite numbers. Prime numbers are two concepts that are opposite to Union numbers. They constitute one of the most basic definitions in number theory. The problems created based on the definition of prime numbers have many world-class problems, such as the godebach conjecture. The basic arithmetic theorem proves that each positive integer greater than 1 can be written as the product of a prime number, and the product form is unique. The important point of this theorem is that 1 is excluded from the prime number set. If 1 is considered as a prime number, these strict interpretations have to add some restrictions.

Concept

There is only one natural Number with two divisor, called Prime Number ). (For example, from 2 then 1 = 2 then 2 then 2 = 1, we can see that the divisor of 2 is only the two divisor of 1 and itself 2, SO 2 is the prime number. Relative to this is the Union number: "In addition to the two dikes of 1 and itself, there are also other divisor numbers, called the Union number ." For example, 4 distinct 1 = 4 distinct 2 = 2, 4 distinct 4 = 1. Obviously, the divisor of 4 excludes 1 and 4, and there is also divisor 2, so 4 is the sum .)
The prime numbers within 100 include 100, and. There are 25 prime numbers in.
Note: (1) 1. It is neither a prime nor a combination. Because it has only one divisor.
(2) 2 and 3 are the only two connected numbers in all prime numbers.

 

Input description Input Description

Enter a positive integer n, n <= 30000

 

Output description Output Description

If this number is a prime number, \ t is output.

Otherwise output \ n

Sample Input Sample Input

Input Example 1

13

Input Example 2

8

Sample output Sample Output

Sample output 1

\ T

Sample output 2

\ N

Data range and prompt Data Size & Hint

C or c ++ beginners note that "\" means

 
 1 #include<bits/stdc++.h> 2 using namespace std; 3 int a[10001]; 4 int now; 5 int main() 6 { 7     int n; 8     cin>>n; 9     for(int i=2;i<n-1;i++)10     {11         if(n%i==0)12         {13             cout<<"\\n";14             return 0;15         }16     }17     cout<<"\\t";18     return 0;19 }

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.