High Accuracy-the number of gold segments (the first 100 digits) and the number of gold segments (the first 100 digits)
Description:
The golden split number 0. 61823... is an irrational number. This constant is very important and may occur in many engineering problems. Sometimes this number must be accurate.
For some precision engineering, the accuracy of these constants is very important. Maybe you have heard of the first time that the telescope was launched, it found a human processing error, in fact, it was just a mistake that the mirror was several times thinner than the first hair, but it became a "myopia "!!
How can we obtain the value of the Golden split number as accurate as possible? There are many methods.
One simple method is to use the join score:
The more layers the score is calculated, the closer the value is to the Golden split number.
Please use this feature to find the exact value of the prime number, which requires rounding to the last 100 digits.
The value of the last three decimal places is 0.618.
The value of the last four decimal places is 0.6180.
The value of the last 5 digits is 0.61803.
The value of the last 7 decimal places is 0.6180340.
(Note that the end is 0)
Your task is to write the golden split value with a decimal precision of 100 digits.
# Include <iostream> # include <cmath> # include <cstdio> using namespace std; long a [100], B [101]; long f (int n) {if (a [n]! = 0) return a [n]; if (n = 1 | n = 2) return a [0] = a [1] = 1; else {a [n-1] = f (n-1); a [N-2] = f (n-2); return a [n-1] + a [N-2] ;}} int main () {double c = 1; f (80); // The precision of using 50 items is the question: why do 50 digits need to be selected? // If you use the three values greater than the values in the fibonacci series, for example, // 121393/196418 = 0. 618033988738... // 196418/317811 = 0. 618033988754... // only 10 digits after the decimal point are allowed. // a large integer (about 50 digits) is required for division, the precision of unsigned long int x = a [50-2]; unsigned long int y = a [50-1]; for (int I = 0; I <101; I ++) {// cout <x <"" <y <""; // simulate manual computation. For example, if the first digit except 8 and 13 is saved to the array and the remainder is 8*10, then perform the next manual computation. // then perform the Division after 8*10, that is, 13/80 = 6. the second digit stores the remainder of the array and continues 2*10 // then the 20/13 equals 1 remainder and * 10 ........ I really don't understand how to calculate it on paper. I understand a [I] = x/y; x = (x % y) * 10; printf ("% d ", a [I]); // use the preceding method to output Multiple Digits one by one} return 0 ;}
Implementation Code