NKABD - Số phong phú
Tác giả: hieult
Ngôn ngữ: C++
#include <stdio.h>
//#include <conio.h>
#include <math.h>
main()
{
int a,b,t,x=0,n;
scanf("%d %d",&a,&b);
n=a;
while(n!=b+1)
{
if(n==1)
{
n++;
continue;
}
else
{
if((n%6==0 &&n!=6) || n%20==0)
x++;
else if(n%2!=0 && n%3!=0);
else
{
t=1;
for(int i=2;i*i<=n;i++)
{
if(i*i==n)
t = t+i;
else if(n%i==0)
t=t+i+n/i;
}
if(t>n)
x++;
}
n++;
}
}
printf("%d",x);
//getch();
}