Maximum number of digits in numbers between 0 to n^2−1 of base n log_n(n^2) = 2 log_n n = 2

phumzaRdY

phumzaRdY

Answered question

2022-11-25

Maximum number of digits in numbers between 0 to n 2 1 of base n
The number of digits in numbers between 0 and n 2 1 of base n is obtained by
log n ( n 2 ) = 2 log n n = 2
But why log is being used? I mean how doing log gives correct answer always?

Answer & Explanation

Melanie Lam

Melanie Lam

Beginner2022-11-26Added 12 answers

In base n, n is represented as 10 n . So
10 n 2 = 100 n
That's 3 digits.
Now 1 + log n ( n 2 ) = 3. Done.
Jamir Summers

Jamir Summers

Beginner2022-11-27Added 2 answers

About the number of digits of a number n 2 in base b:
Let n have the representation
n = ( d m 1 d 1 d 0 ) b = k = 0 m 1 d k b k
with m digits from { 0 , , b 1 }. Then we have
n < b m n 2 < b 2 m
This means n 2 has at most 2 m 1 digits.
To derive m for a given n we use some logarithm:
n < b m log n < log b m = m log b log n log b < m
The smallest m should be
m = log n log b + 1
The special case b = n gives m = 2 and that n 2 has at most 3 digits.
As pointed out by fellow users n 2 = ( 100 ) n has exactly 3 digits, which means that your formula, which gives 2 digits, is not correct.

Do you have a similar question?

Recalculate according to your conditions!

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?