Skip to main content
added 632 characters in body
Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103

JavaScript (Node.js), 51 bytes

f=(n,i=6)=>n>1&&Math.min(i+f(n/--i),i>2?f(n,i):1/0)

Try it online!

JavaScript (Node.js), 50 bytes by Shaggy porting xnor

f=n=>n>1&&Math.min(...[2,3,4,5].map(x=>x-~f(n/x)))

Try it online!

JavaScript (Node.js), 51 bytes

f=(n,i=6)=>n>1&&Math.min(i+f(n/--i),i>2?f(n,i):1/0)

Try it online!

JavaScript (Node.js), 51 bytes

f=(n,i=6)=>n>1&&Math.min(i+f(n/--i),i>2?f(n,i):1/0)

Try it online!

JavaScript (Node.js), 50 bytes by Shaggy porting xnor

f=n=>n>1&&Math.min(...[2,3,4,5].map(x=>x-~f(n/x)))

Try it online!

deleted 93 characters in body
Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103

JavaScript (Node.js), 5551 bytes

f=n=>n>1&&Mathf=(n,i=6)=>n>1&&Math.min(fi+f(n/2--i)+3,i>2?f(n/3)+4,f(n/4i)+5,f(n:1/5)+60)

Try it online!

f(n/6)+7 can be f(n/2/3)+3+4 so up to f(n/5)+6 is enough. Test case don't show it though.Try it online!

JavaScript (Node.js), 55 bytes

f=n=>n>1&&Math.min(f(n/2)+3,f(n/3)+4,f(n/4)+5,f(n/5)+6)

Try it online!

f(n/6)+7 can be f(n/2/3)+3+4 so up to f(n/5)+6 is enough. Test case don't show it though.

JavaScript (Node.js), 51 bytes

f=(n,i=6)=>n>1&&Math.min(i+f(n/--i),i>2?f(n,i):1/0)

Try it online!

Source Link
l4m2
  • 28.3k
  • 2
  • 25
  • 103

JavaScript (Node.js), 55 bytes

f=n=>n>1&&Math.min(f(n/2)+3,f(n/3)+4,f(n/4)+5,f(n/5)+6)

Try it online!

f(n/6)+7 can be f(n/2/3)+3+4 so up to f(n/5)+6 is enough. Test case don't show it though.