1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#include <iostream>
using namespace std;
int main()
{
long long bignumber=1;// avoid the false positive of 0
int primecount=0;
long long answer=0;
int primes[25]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
while (bignumber<10000000000000000) // 10^16
{
primecount=0;
if (bignumber%10000000==0)// to see progress
{
cout << bignumber << " " << answer << endl;
}
for (int i=0; i<25; i++)
{
if (bignumber%primes[i]==0)
{
primecount++; // maybe I should do the division
if (primecount==4)
{
answer++;
break;
}
}
}
bignumber++;
}
cout << answer << endl;
cin.clear(); // to view the end result;
cin.ignore(255, '\n');
cin.get();
return 0;
}
| |