Skip to main content
now using the fixed formula
Source Link
Arnauld
  • 194.6k
  • 20
  • 177
  • 641

JavaScript (ES6), 98 bytes

Basically a direct implementation of the (fixed) formula given in the challenge.

with(Math)f=n=>min(...[81,27,9,6,5,3,2,1].map((v,i)=>ceil(log(n/v)/log(4))*5-~(37115839>>i*4&1537115838>>i*4&15)))

Try it online!Try it online!

JavaScript (ES6), 98 bytes

Basically a direct implementation of the formula given in the challenge.

with(Math)f=n=>min(...[81,27,9,6,5,3,2,1].map((v,i)=>ceil(log(n/v)/log(4))*5-~(37115839>>i*4&15)))

Try it online!

JavaScript (ES6), 98 bytes

Basically a direct implementation of the (fixed) formula given in the challenge.

with(Math)f=n=>min(...[81,27,9,6,5,3,2,1].map((v,i)=>ceil(log(n/v)/log(4))*5-~(37115838>>i*4&15)))

Try it online!

Source Link
Arnauld
  • 194.6k
  • 20
  • 177
  • 641

JavaScript (ES6), 98 bytes

Basically a direct implementation of the formula given in the challenge.

with(Math)f=n=>min(...[81,27,9,6,5,3,2,1].map((v,i)=>ceil(log(n/v)/log(4))*5-~(37115839>>i*4&15)))

Try it online!

-