daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest Jan 11th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function factoring(n){
  2.   const arr = [];
  3.   let i = 2;
  4.  
  5.   do {
  6.     if (n % i) {
  7.       i++;
  8.     } else {
  9.       arr.push(i);
  10.       n = n / i;
  11.     }
  12.   } while (i < n)
  13.  
  14.   arr.push(i);
  15.  
  16.   return arr;
  17. }
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
 
Top