Having a problem regarding Infinite loop detection on one of my problems?

Good Morning, I’m Shounak Mandal, I have joined this site recently to enhance and sharpen my skills at coding. Past these days I have been learning many things from your site and have solved and understood many coding patterns and by solving the different JavaScript programs. I’ve come to one particular error which I’m unable to understand, why its appearing.

The error which is showing on my console is " Infinite Loop Detection" and the problem which I’m working on is to find out LCM of a particular range.

And the code which I’ve come up with is this, :-

function primeSeries(num) {
  let primSer = []
  for(let i=2; i<=num; i++){
    let count = 0;
    for(let j=1; j<=i; j++){
  return primSer

function primeFactors(num) {
  let primFac = []
  let fac = primeSeries(50); 
     let i=0;
        num = num/fac[i]
  return primFac

function smallestCommoms(){
let a = primeFactors(80)
let b = primeFactors(84)
let c = primeFactors(126)
return {a,b,c}

Well the function is still incomplete but till now it can compute the prime factors of any given number. Well I was hoping you could help me with my issue and tell me where I’ve to do the necessary changes.

hello and welcome to fcc forum :slight_smile:

  • share this step “url” as well

happy coding :slight_smile:

please note that wherever, you are seeing square symbol, replace it with square brackets ( <= with this )it was a copy paste mistake.

You have picked a slow prime factorization algorithm and prime factorization is the slowest approach to solving this problem. I’d reconsider your approach, doing some research on Wikipedia on LCM

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.