The number of divisors(约数) about Humble Numbers

Posted huanya

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了The number of divisors(约数) about Humble Numbers相关的知识,希望对你有一定的参考价值。

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
#define maxn 1000005
typedef long long ll;

int p[4]={2,3,5,7};
ll a[4];
bool book[1000005];
void fun(ll n)
{
for(int i=0;i<=3;i++)
{
while((n%p[i]==0) && (n!=0))
{
n=n/p[i];
a[i]++;
}
}
}
int main ()
{
ll n;

while(scanf("%lld",&n)!=EOF)
{
ll sum=1;
memset(a,0,sizeof(a));
if(n==0)
break;
//memset(book,true,sizeof(book));
//memset(a,0,sizeof(a));
if(n==1)
sum=1;
else if(n==2||n==3)
sum=2;
else
{
fun(n);
for(int i=0;i<=3;i++)
{
if(a[i]!=0)
sum=sum*(a[i]+1);
}
}
cout<<sum<<endl;
}
return 0;
}

















































以上是关于The number of divisors(约数) about Humble Numbers的主要内容,如果未能解决你的问题,请参考以下文章

codeforces 27E . Number With The Given Amount Of Divisors 搜索+数论

数学CF27E Number With The Given Amount Of Divisors

Odd Numbers of Divisors

每天一道博弈论之“The jar of divisors”

UVA - 294 Divisors (约数)(数论)

UVA294DIvisors(唯一分解定理+约数个数)