1.尼科彻斯定理
This program is to verify Theorem of Nicoqish.That is the cube of any integer can be represented as the sum of some continue odd numbers.For example, 8^3=512=57+59+61+63+65+67+69+71.
#include <iostream>
using namespace std;
int main()
{
int n,a,i;
while(1)
{
cout<<"Please input a integer to verify(0 to quit): ";
cin>>n;
if(n==0) __________; // (1)
// 输出等差数列,首项为a*a-a+1,公差为2,项数为n
a=n*n-n+1;
cout<<n<<"*"<<n<<"*"<<n<<"="<<n*n*n<<"="<<a;
for (i=1; __________;i++) // (2)
cout<<"+"<<__________; // (3)
cout<<endl;
}
return 0;
}
2.角谷猜想
This program is to verify Jiaogu Guess.That is given any natural number, if it is an even, divides 2, if it is an odd, multiple 3 and add 1, the result continues to be calculated analogously. After some times, the result is always 1.
#include <iostream>
using namespace std;
int main()
{
int n,a,i,cnt;
while(1)
{
cout<<"Please input a integer to verify(0 to quit): ";
cin>>n;
if(n==0) __________break; // (1)
cnt=0;
cout<<" ------ Results of verification: ------------\n";
do{
if(__________) // (2)
{
n=n*3+1;
cout<<"Step No."<<++cnt<<":"&l