Hdu 5108 Alexandra and Prime Numbers (water problem, violence)

Source: Internet
Author: User

Problem Descriptionalexandra has a little brother. He is new to programming. One day he's solving the following problem:given an positive integer n, and judge whether N is prime. The problem above is quite easy, so Alexandra gave him a new task:given a positive integer N, find the minimal positive I Nteger M, such that n/m is prime. If such M doesn ' t exist, output 0. Help him!

Inputthere is multiple test cases (no more than 1,000). Each case contains only one positive integer N.N≤1 , A.. Number of cases with N>1,than, are No more than 100.

Outputfor each case, output the requested M, or output 0 if no solution exists.

Sample Input3456

Sample Output1212

Find the maximum factor of n, dividing by n by the maximum factor of the element. Note that the 1 element-free factor should be given special consideration.

Hdu 5108 Alexandra and Prime Numbers (water problem, violence)

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.