Smoj 1069 antiprime (http: // 218.5.241.13: 8060/OJ/showproblem. jsp? PID = 1069)

Source: Internet
Author: User

I. Definition: If a number M has more than any natural number smaller than m, this number is called antiprime. For example, 1, 2, 4, 6, 12, and 24.

2. theorem set m = 2 ^ T1 × 3 ^ T2 × ...... * P ^ TK (where p is the prime number of K) is the antiprime number, then T1 must be ≥t2 ≥t3 ≥ ...... ≥ TK ≥ 0.

Use the reverse certificate. (Omitted)

Iii. Analysis

1. Since n can reach 2*10 ^ 9, it takes more time to use enumeration.

2. When n = 2*10 ^ 9, there are only 1456 antiprime instances. Therefore, you can search and store all such numbers, and record the approximate number of each number. Sort them from small to large, and then determine the antiprime numbers one by one, and take the maximum value. For example, if n = 15, the number of the conditions is 1, 2, 4, 6, and 12, and the number of the approximate numbers is 1, 2, 3, 4, 4, and 6, respectively, therefore, the number of antiprime values not greater than 15 is 1, 2, 4, 6, and 12, and the maximum value is 12.

4. Because 2 ^ 31 is close to 2*10 ^ 9, the index of 2 ranges from 31 to 30 ...... Search down. Use the Backtracking Method.

Related Article

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.