Question: In the FIBONACCI series, the feature of the FIBONACCI series is 1st. The number of 2nd is 1, and 1. Starting from 3rd, this number is the sum of the first two numbers, and the first 30 elements of this series are obtained.
Analysis: The onacci Sequence column is used to calculate the number of podanes, the Fibonacci number column, the Gini number column, and the Golden split number column. In terms of data, the na west data column is determined by the linear regression method:
F0 = 0
F1 = 1
Fn = Fn-1 + Fn-2
In words, the Number Column starts from 0 and 1, and the number of the last wave is the sum of the previous two. The number of the first wave in the Spanish region is (OEIS A000045 ):
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,144,233,377,610,987,159 7, 2584,
4181,676 5, 10946 ,..................
Note that 0 is not the first Shard, but the second shard. (Reference)
The following equation can be used to represent the Fibonacci series:
F1 = 1 ---- (n = 1 );
F2 = 1 ---- (n = 1 );
Fn = F (n-1) + F (n-2) ----- (n> = 3)
Here we regard the subscript of F as an array subscript Code as follows:
# Include <stdio. h> # include <stdlib. h> int main () {int I;/* defines the integer variable */long f [31]; /* define the array as a long integer */f [1] = f [2] = 1;/* f [1] of the array, f [2] assigned to 1 */for (int I = 3; I <31; I ++) {f [I] = f [I-1] + f [I-2]; /* the array starts from the third row, and each item is equal to the sum of the first two items */} for (I = 1; I <31; I ++) {printf ("% 10ld ", f [I]);/* 30 elements in the output array */if (I % 5 = 0) printf (""); /* line feed every five elements */} system ("PAUSE ");}
Result:
Question: anggu conjecture, any natural number. When he is an even number, he is divided by 2. When he is an odd number, he is multiplied by 3 and 1 to get a new natural number, follow this rule in sequence to continue the calculation. After many times, a result will be obtained. The result is 1...
Analysis: kokoz conjecture, also known as the 3n + 1 Conjecture, hail conjecture, anggu conjecture, Hasse conjecture, ouram conjecture, or suragu conjecture, refers to each positive integer, if it is an odd number, multiply it by 3 and Add 1. If it is an even number, divide it by 2. In this way, the loop will eventually get 1. (Wikipedia)
The analysis on some questions shows that the focus is to determine whether a number is an odd or even number. The program uses the method of getting the remainder of 2. When the remainder is 0, it indicates that this number is an even number. Otherwise, it is an odd number.
Example: Take a number
For example, if n = 6, 6 → 3 → 10 → 5 → 16 → 8 → 4 → 2 → 1 are obtained based on the preceding formula. (The highest number in a step is 16, with a total of 7 steps)
For example, n = 11, according to the preceding formula, 11 → 34 → 17 → 52 → 26 → 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1. (The highest number in a step is 40, with a total of 13 steps)
For example, n = 27. Based on the preceding formula, the following result is obtained: 27 → 82 → 41 → 124 → 62 → 31 → 94 → 47 → 142 → 71 → 214 → 107 → 322 → 161 → 484 → 242 → 121 → 364 → 182 → 91 → 274 → 137 → 412 → 206 → 103 → 310 → 155 → 466 → 233
→ 700 → 350 → 175 → 526 → 263 → 790 → 395 → 1186 → 593 → 1780 → 890 → 445 → 1336 → 668 → 334 → 167 → 502 → 251 → 754 → 377 → → 1132 → 566 → 283 → 850 → 425 → 1276
→ 638 → 319 → 958 → 479 → 1438 → 719 → 2158 → 1079 → 3238 → 1619 → 4858 → 2429 → 7288 → 3644 → 1822 → 911 → 2734 → 1367 → 4102 → 2051 → → 6154 → 3077 → 9232
→ 4616 → 2308 → 1154 → 577 → 1732 → 866 → 433 → 1300 → 650 → 325 → 976 → 488 → 244 → 122 → 61 → 184 → 92 → 46 → 23 → 70 → 35 → 106 → 53 → 160 → 80 → 40 → 20 → 10
→ 5 → 16 → 8 → 4 → 2 → 1. (The highest number in a step is 9232, with a total of 111 steps)
Koala conjecture that any positive integer, after the above calculation steps, will eventually get 1. Code:
# Include <stdio. h> # include <stdlib. h> void main () {long I, n; // defines the variable as a long integer printf ("please input a number :"); // input any number of long integer scanf ("% ld", & n); while (n! = 1) {if (n % 2 = 0) // judge whether it is an even number {printf ("% ld/2 = % ld", n, n/2 ); // when it is an even number, n is divided by 2 n = n/2;} else {printf ("% ld * 3 + 1 = % ld", n, n * 3 + 1); // multiply by 3 plus 1 n = n * 3 + 1;} system ("pause ");}
Result:
Question: According to the gedebach conjecture, all positive and even numbers within 100 can be decomposed into the sum of two prime numbers.
Analysis: an even number greater than 2 represents the sum of two geometries.
A given logarithm is expressed as the sum of the two geometries, which is separated by the godebach representing the number. For example,
4 = 2 + 2
6 = 3 + 3
8 = 3 + 5
10 = 3 + 7 = 5 + 5
12 = 5 + 7
14 = 3 + 11 = 7 + 7
...
In short, he guessed that each of the 4-digit numbers in the primary node is the sum of the two [1]. Godebach's conjecture is also a sub-Problem in the Eighth Question of sizombert.
Another similarity conjecture for odd numbers is called Lemoines conjecture or Levys conjecture ).
In order to verify the positive and even numbers of less than 100, we need to divide the positive and even numbers into two parts. In this case, we need to judge the two parts. If both of them are prime numbers, this will satisfy our needs, otherwise, the code will be re-decomposed to continue judgment:
# Include <stdio. h> # include <stdlib. h> int ss (int I)/* Indicates whether a function is a prime number */{int j; if (I <= 1) /* less than 1 is not a prime number */return 0; if (I = 2)/* 2 is a prime number */return 1; for (j = 2; j <I; j ++)/* determine if the value is greater than 2 */{if (I % j = 0) return 0; else if (I! = J + 1) return 1 ;}} void main () {int I, j, k, flag1, flag2, n = 0; for (I = 6; I <100; I + = 2) for (k = 2; k <= I; k ++) {j = I-k; flag1 = ss (k); if (flag1) /* determine whether the number of splits is a prime number */{flag2 = ss (j); if (flag2) /* If the split number is a prime number, output */{printf ("% 3d = % 3d + % 3d", I, j, k); n ++; if (n % 5 = 0) printf ("") ;}} system ("pause");} result:
Question: Square theorem, all natural numbers can be expressed as long as the sum of the squares of four numbers. Programming Verification
The results can be calculated using the exhaustive testing method. When the conditions of the theorem are met, the results can be output.
Code:
# Include <stdio. h> # include <stdlib. h> int main () {long I, j, k, l, n; // defines the variable as a long integer printf ("enter a long integer "); scanf ("% ld", & n); for (I = 0; I <n; I ++) // pair I, j, k, l for (j = 0; j <I; j ++) for (k = 0; k <j; k ++)