Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int a[]= {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};
- int cnt[100];
- int n,x,i,j;
- while(scanf("%d",&n)){
- if(n==0)break;
- memset(cnt,0,sizeof cnt);
- for(i=2;i<=n;i++){
- x=i;
- for(j=0;j<25;j++){
- int count=0;
- while(x%a[j]==0){
- count++;
- x/=a[j];
- }
- cnt[j]+=count;
- }
- }
- for(i=0;a[i]<=n;i++){
- if(cnt[i]==0)continue;
- printf("%d ",cnt[i]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement