hopingsteam

Untitled

Apr 3rd, 2020
126
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unsigned int factori(unsigned int n, unsigned int m)
  2. {
  3. unsigned int apN[10000];
  4. unsigned int apM[10000];
  5.  
  6. int div = 2;
  7. int exp = 0;
  8. while(n > 1)
  9. {
  10. while(n % div == 0)
  11. {
  12. n = n / div;
  13. exp++;
  14. }
  15. if(exp != 0)
  16. apN[div]++;
  17. div++;
  18. exp = 0;
  19. }
  20.  
  21. div = 2;
  22. exp = 0;
  23. while(m > 1)
  24. {
  25. while(m % div == 0)
  26. {
  27. m = m / div;
  28. exp++;
  29. }
  30. if(exp != 0)
  31. apM[div]++;
  32. div++;
  33. exp = 0;
  34. }
  35. int result = 0;
  36. for(int i = 2; i <= 10000; i++)
  37. if(apN[i] != 0 && apM[i] != 0)
  38. result++;
  39. return result;
  40. }
RAW Paste Data