Project Euler #179: Consecutive positive divisors

  • + 0 comments

    Can anyone tell me what am I missing?? I am able to pass test case 0 not rest of them . Please help thank you

    con <- file("stdin", open = "r")
    data <- as.numeric(readLines(con))
    
    for (i in 1:data[1]){
        I <- data[i+1]
        n <- array(0,dim = I)
    for (i in 1:floor((I-1)/2)){
      for (j in seq(i*2,I, by = i)){
        n[j]= n[j]+1
      } 
     }
     b <- 0
     for(i in 2:I){
      if((n[i]==n[i-1])==TRUE){
        b <- b+1
      }
     }
         cat(b,sep = "\n")
    }