This idea can be understood through 2.2.1:
First, let's look at the nature of the logarithm. Loga (B ^ c) = C * Loga (B), Loga (B * C) = Loga (B) + Loga (C );
Assume that a number of 10234432 is given, then log10 (10234432) = log10 (1.0234432*10 ^ 7) = log10 (1.0234432) + 7;
Log10 (1.0234432) is the fractional part of log10 (10234432.
Log 10 (1.0234432) = 0.010063744
10 ^ 0.010063744 = 1.023443198
So it is obvious that we need to take a few digits ~
First take the logarithm (for 10), and then get the fractional part of the result bit, POW (10.0, bit), if the answer is still <1000, then always multiply by 10.
Note that 0 ~ is processed first ~ 20 items to facilitate processing ~
This question uses the formula of the series: An = (1/√ 5) * [(1 + √ 5)/2) ^ N-(1-√ 5) /2) ^ N] (n = 1, 2, 3 .....)
Obtain the logarithm
Log10 (an) =-0.5 * log10 (5.0) + (double) n) * log (f)/log (10.0) + log10 (1-(1-√ 5)/(1 + √ 5) ^ N)
Where f = (SQRT (5.0) + 1.0)/2.0;
Because log10 (1-(1-√ 5)/(1 + √ 5) ^ N) approaches 0
Therefore, you can write log10 (an) =-0.5 * log10 (5.0) + (double) n) * log (f)/log (10.0 );
Finally, the fractional part is taken.
Take the first few digits of a large number.