SHARE
TWEET

Untitled

a guest Dec 9th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const getGets = (arr) => {
  2.     let index = 0;
  3.  
  4.     return () => {
  5.         const toReturn = arr[index];
  6.         index += 1;
  7.         return toReturn;
  8.     };
  9. };
  10. // this is the test
  11. const test = [
  12.     '10'
  13. ];
  14.  
  15. const gets = this.gets || getGets(test);
  16. const print = this.print || console.log;
  17.  
  18. let number = Number(gets())
  19. let numArray = []
  20. let primeArray = []
  21. let nonprimeArray = []
  22.  
  23. for(let i = 1; i < number; i++){
  24.     numArray.push(i)    
  25. }
  26.  
  27. for(let i = 2; i < numArray.length; i++){
  28.  
  29.     if(numArray[i] % i === 0){
  30.         nonprimeArray.push(numArray[i])
  31.         console.log(nonprimeArray)
  32.     }
  33.     else if(numArray[i] % i !== 0){
  34.         primeArray.push(numArray[i])
  35.         console.log(primeArray)
  36.     }
  37. }
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