JSFiddle - React, Tailwind, and code Playground

by Tom M

JavaScript

function isPrime(num) {
	 for (let j = 2; j < elem; j++) {
			if (elem % j === 0) {
      return false;
      } else {
			return true;
      }
		}
}


function getPrimes(max) {
let primes = [];
	let factors = [];
  for (let i = 2; i <= max; i++) {
      if (max % i === 0) {
      factors.push(i);
      }
    }
}
getPrimes(600851475143);