Skip to main content
added 2 characters in body
Source Link
Command Master
  • 10.7k
  • 1
  • 11
  • 73

Python 3, 25 bytes

lambda n:len(bin(n**n))-3

Try it online!

If the answer is \$x\$, then \$x+1 > n\log{n} >= x\$\$x+1 > n\log{n} \ge x\$ holds true, which means \$2^{x+1} > n^n >= 2^x\$\$2^{x+1} > n^n \ge 2^x\$. So we can simply count the number of bits in the binary representation of \$n^n\$.

Python 3, 25 bytes

lambda n:len(bin(n**n))-3

Try it online!

If the answer is \$x\$, then \$x+1 > n\log{n} >= x\$ holds true, which means \$2^{x+1} > n^n >= 2^x\$. So we can simply count the number of bits in the binary representation of \$n^n\$.

Python 3, 25 bytes

lambda n:len(bin(n**n))-3

Try it online!

If the answer is \$x\$, then \$x+1 > n\log{n} \ge x\$ holds true, which means \$2^{x+1} > n^n \ge 2^x\$. So we can simply count the number of bits in the binary representation of \$n^n\$.

deleted 93 characters in body
Source Link
Manish Kundu
  • 5.3k
  • 2
  • 15
  • 47

Python 3, 4325 bytes

f=lambdalambda n,k=1:n**n<2**k and k-1or flen(n,k+1bin(n**n))-3

Try it online!Try it online!

If the answer is \$x\$, then \$x+1 > n\log{n} >= x\$ holds true, which means \$2^{x+1} > n^n >= 2^x\$. This is very slow but no floating point errors I believeSo we can simply count the number of bits in the binary representation of \$n^n\$.

Python 3, 43 bytes

f=lambda n,k=1:n**n<2**k and k-1or f(n,k+1)

Try it online!

If the answer is \$x\$, then \$x+1 > n\log{n} >= x\$ holds true, which means \$2^{x+1} > n^n >= 2^x\$. This is very slow but no floating point errors I believe.

Python 3, 25 bytes

lambda n:len(bin(n**n))-3

Try it online!

If the answer is \$x\$, then \$x+1 > n\log{n} >= x\$ holds true, which means \$2^{x+1} > n^n >= 2^x\$. So we can simply count the number of bits in the binary representation of \$n^n\$.

Source Link
Manish Kundu
  • 5.3k
  • 2
  • 15
  • 47

Python 3, 43 bytes

f=lambda n,k=1:n**n<2**k and k-1or f(n,k+1)

Try it online!

If the answer is \$x\$, then \$x+1 > n\log{n} >= x\$ holds true, which means \$2^{x+1} > n^n >= 2^x\$. This is very slow but no floating point errors I believe.