fork download
  1. #include <stdio.h>
  2.  
  3. f(n,e,r,i){r=0;for(i=2;n>1;i++,r+=e?e-1:e)for(e=0;n%i<1;e++)n/=i;return r;}
  4.  
  5. int main()
  6. {
  7. for(int i=1;i<=15;i++){
  8. printf("%2d:%d\n",i,f(i));
  9. }
  10.  
  11. return 0;
  12. }
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
 1:0
 2:0
 3:0
 4:1
 5:0
 6:0
 7:0
 8:2
 9:1
10:0
11:0
12:1
13:0
14:0
15:0