HDU 1492 the number of divisors (approx.) about humble numbers (mathematical problem)

Source: Internet
Author: User

Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1492


Problem descriptiona number whose only prime factors are 2, 3, 5 or 7 is called a humble number. the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27 ,... shows the first 20 humble numbers.

Now given a humble number, please write a program to calculate the number of divisors about this humble number. for examle, 4 is a humble, and it have 3 divisors (1, 2, 4); 12 have 6 divisors.


Inputthe input consists of multiple test cases. each test case consists of one humble number N, and N is in the range of 64-BITs signed integer. input is terminated by a value of zero for N.

Outputfor each test case, output its divisor number, one line per case.

Sample Input
 
4120

Sample output
 
36


The Code is as follows:

 
# Include <cstdio> # include <cstring> int main () {_ int64 N; _ int64 A [4] = {2, 3, 5, 7}, B [4]; while (scanf ("% i64d", & N) {memset (B, 0, sizeof (B); For (INT I = 0; I <4; I ++) {While (N % A [I] = 0) {B [I] ++; N/= A [I] ;}} _ int64 ans = (B [0] + 1) * (B [1] + 1) * (B [2] + 1) * (B [3] + 1); printf ("% i64d \ n", ANS);} return 0 ;}


HDU 1492 the number of divisors (approx.) about humble numbers (mathematical problem)

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.