Quote:
Originally Posted by ceptimus
I shall post occasional mathematical 'factoids' here. Please feel free to add your own.
...
(Twin primes are the prime numbers that only differ by two, such as 5 and 7 or 71 and 73. There are conjectured to be an infinity of twin primes, though this has yet to be proven. A large pair are:
33218925 * 2^169690 +/- 1, which have 51,090 digits each.
...
|
It's interesting that they know the number of digits in the result.
In fact, you can compute the number of digits in any integer without having to carry out the complete computation or actually count the resulting digits at all.
Here's how to do it:
Based on the given data, the number of digits in the prime numbers above can be found by the formula:
Digits = floor((ln(33218925) + ln(2)*169689) / ln(10)) + 1
= 51090
in terms of natural logarithms.
The computation can be simplified by using base 10 logarithms instead, as:
Digits = floor((log(33218925) + log(2)*169689)) + 1
= 51090
Note for clarity:
ln = Natural logarithm
log = base 10 logarithm
For the general case, let
X = Integer (positive) in question
D = Number of digits in X
To find the unknown number of digits in X
D = floor(log(X)) + 1
EXAMPLE:
Given
X = 6^29000
log(X) = log(6)*29000
Then,
D = floor(log(X)) + 1 = floor(log(6^29000)) + 1
or
D = floor(22566.3862611) + 1 = 22567 digits in X
FOR INTEGERS IN OTHER BASES:
A base 10 integer (X) after conversion to base (B) has (D) digits.
where:
D = floor(log(X) / log(B)) + 1
EXAMPLE:
The base 10 value (13^967), when converted to base 2, would have (D) digits, where
D = floor(log(13^967) / log(2)) + 1
= floor(1077.18322168 / 0.301029995664) + 1
= 3578 + 1 = 3579 digits