SHARE
TWEET

Untitled

nikolayneykov May 21st, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function isPrime (num) {
  2.   for (let i = 2; i <= Math.sqrt(num); i++) {
  3.     if (num % i === 0) {
  4.       return false
  5.     }
  6.   }
  7.  
  8.   return true
  9. }
  10.  
  11. let num = +gets()
  12.  
  13. for (let factor = 2; factor <= num; factor++) {
  14.   while (num % factor === 0 && isPrime(factor)) {
  15.     print(factor)
  16.     num /= factor
  17.   }
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top