Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#JavaScript ES6 112

JavaScript ES6 112

c=n=>{with(a=[]){for(i=k=1;i++<n;)for(;1^n%i;n/=i)push(++k%2?pop()*i:i);k%2||push(pop()*pop());return k<3?[]:a}}
test=k=>{console.log("n = "+k);console.log(c(k))};
test(-1);
test(0);
test(2);
test(4);
test(64);
test(96);
test(32);

#JavaScript ES6 112

c=n=>{with(a=[]){for(i=k=1;i++<n;)for(;1^n%i;n/=i)push(++k%2?pop()*i:i);k%2||push(pop()*pop());return k<3?[]:a}}
test=k=>{console.log("n = "+k);console.log(c(k))};
test(-1);
test(0);
test(2);
test(4);
test(64);
test(96);
test(32);

JavaScript ES6 112

c=n=>{with(a=[]){for(i=k=1;i++<n;)for(;1^n%i;n/=i)push(++k%2?pop()*i:i);k%2||push(pop()*pop());return k<3?[]:a}}
test=k=>{console.log("n = "+k);console.log(c(k))};
test(-1);
test(0);
test(2);
test(4);
test(64);
test(96);
test(32);

deleted 1 character in body
Source Link
kuilin
  • 421
  • 3
  • 9

#JavaScript ES6 113112

c=n=>{with(a=[]){for(i=k=1;i++<n;)for(;1^n%i;n/=i)push(++k%2?pop()*i:i);k%2?5:push;k%2||push(pop()*pop());return k<3?[]:a}}
test=k=>{console.log("n = "+k);console.log(c(k))};
test(-1);
test(0);
test(2);
test(4);
test(64);
test(96);
test(32);

#JavaScript ES6 113

c=n=>{with(a=[]){for(i=k=1;i++<n;)for(;1^n%i;n/=i)push(++k%2?pop()*i:i);k%2?5:push(pop()*pop());return k<3?[]:a}}
test=k=>{console.log("n = "+k);console.log(c(k))};
test(-1);
test(0);
test(2);
test(4);
test(64);
test(96);
test(32);

#JavaScript ES6 112

c=n=>{with(a=[]){for(i=k=1;i++<n;)for(;1^n%i;n/=i)push(++k%2?pop()*i:i);k%2||push(pop()*pop());return k<3?[]:a}}
test=k=>{console.log("n = "+k);console.log(c(k))};
test(-1);
test(0);
test(2);
test(4);
test(64);
test(96);
test(32);

deleted 4 characters in body
Source Link
kuilin
  • 421
  • 3
  • 9

#JavaScript ES6 117113

c=n=>{with(a=[]){for(i=k=1;i++<=n;i=k=1;i++<n;)for(;!(n%i);n;1^n%i;n/=i)push(++k%2?pop()*i:i);return k%2?a:k<3;k%2?[]5:push(pop()*pop());return k<3?a[]:a}}
test=k=>{console.log("n = "+k);console.log(c(k))};
test(-1);
test(0);
test(2);
test(4);
test(64);
test(96);
test(32);

#JavaScript ES6 117

c=n=>{with(a=[]){for(i=k=1;i++<=n;)for(;!(n%i);n/=i)push(++k%2?pop()*i:i);return k%2?a:k<3?[]:push(pop()*pop())?a:a}}
test=k=>{console.log("n = "+k);console.log(c(k))};
test(-1);
test(0);
test(2);
test(4);
test(64);
test(96);
test(32);

#JavaScript ES6 113

c=n=>{with(a=[]){for(i=k=1;i++<n;)for(;1^n%i;n/=i)push(++k%2?pop()*i:i);k%2?5:push(pop()*pop());return k<3?[]:a}}
test=k=>{console.log("n = "+k);console.log(c(k))};
test(-1);
test(0);
test(2);
test(4);
test(64);
test(96);
test(32);

deleted 6 characters in body
Source Link
kuilin
  • 421
  • 3
  • 9
Loading
Source Link
kuilin
  • 421
  • 3
  • 9
Loading

AltStyle によって変換されたページ (->オリジナル) /