Inverse Prime Depth analysis

Source: Internet
Author: User

Loaded from: http://blog.csdn.net/ACdreamers/article/details/25049767

Small Knowledge Points:

If you ask for the number of 756=2^2*3^3*7^1

(2+1) * (3+1) * (+) =24

Based on the above conclusions, the algorithm is given to search each quality factor in ascending order of factorization size, and enumerate each quality factor.

To prune:

Property One: The mass factor of an inverse prime is bound to be a continuous prime number starting from 2.

Because a maximum of 10 primes is required: 2,3,5,7,11,13,17,19,23,29

Nature two: P=2^t1*3^t2*5^t3*7^t4 ..... Inevitably t1>=t2>=t3>= ....

The problem encountered when learning the inverse prime.

Given a number, a minimum positive integer is obtained, making an approximate number of

Probably read. Build your search on every level. But I still don't understand.

1 #include <stdio.h>2 #include <String.h>3 #include <iostream>4UsingNamespaceStd56 typedef unsignedLongLongULL;7Const ULL INF = ~0ull;//Represents Infinity.89int p[16] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53};//A number must be able to be split into prime numbers multiplied by the form,1011IntN12ULL ans;1314void Dfs (int dept, ULL TMP,int num) {//Dept indicates the depth of the search. Num is an approximate number of the current number. TMP indicates the number of current cable representations,15if (num > N)Return//If it's about a few numbers >n16if (num = = n && ans > tmp) ans = tmp;//If the approximate number is just n. And this number is smaller than the previous number, it is recorded,17for (int i=1; i<=63; ++i) {//In fact, I think it started from 0,???18if (Ans/p[dept] < TMP)Break//Don't know why this is the end of the loop condition. Or is this the end of the story???DFS (dept+1, tmp *= p[dept], num* (i+1));//I is the number of p[dept on behalf of this layer] this factor,20}21st}2223int Main () {( cin >> N) {. ans = INF;  DFS (0, 1, 1);  cout << ans << endl; // tried to output in C language. Did not try to come out, ...???    0;                     (+} 

Inverse Prime Depth analysis

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.