fork download
  1. let box = new Array(30).fill(0);
  2. for(let i = 1; i <= 30; i++) {
  3. for(let j = i; j <= 30; j += i) {
  4. box[j - 1]++;
  5. }
  6. }
  7. print("1. ", box.filter(v => v === 2).length);
  8. print("2. ", box.filter(v => !(v % 2)).length);
  9.  
Success #stdin #stdout 0.04s 17076KB
stdin
Standard input is empty
stdout
1.  10
2.  25