Skip to main content
2 of 2
added 643 characters in body
MarcMush
  • 6.6k
  • 13
  • 17

Julia, 18 24 bytes

n->ndigits(n^n,base=2)-1

Try it online!

port of Manish Kundu's answer

previous answer:

n->floor(log2(n)n)

Try it online!

input needs to be a BigInt to avoid floating point errors.

Technically invalid because you need to augment the precision for very big numbers (with setprecision(2048) for example for 10^100)

MarcMush
  • 6.6k
  • 13
  • 17