Title Description

To test the Nicolas Theorem , namely ： The cube of any positive integer can be written as the sum of a series of continuous odd numbers .

Input

Any positive integer

Output

The cube of the number is decomposed into the sum of a series of continuous odd numbers

The sample input

13

Sample output

13*13*13=2197=157+159+161+163+165+167+169+171+173+175+177+179+181

Tips

This problem is a theorem , Let's prove it first .

For any positive integer a, Regardless of a Is it odd or even , Integers (a×a-a+1) It must be odd .

Construct a sequence of equal difference numbers , The first term of the sequence is (a×a-a+1), The difference of the arithmetic sequence is 2( Odd number sequence ), Before a The sum of items is ：

a×((a×a-a+1))+2×a(a-1)/2

=a×a×a-a×a+a+a×a-a

=a×a×a

The theorem holds . Certificate completion .

Through the proof process of the theorem, we can know that L The first term of the required odd sequence is (a×a-a+1), The length is a. Programming algorithms don't need special design ,

It can be verified directly according to the proof of the theorem .*/

#include<iostream>

using namespace std;

int main()

{

unsigned long long a,i,c;

cin>>a;

if(a>0)

{

unsigned long long b[a];

b[0]=a*a-a+1;

for(i=1;i<a;i++)

{

b[i]=b[i-1]+2;

}

c=a*a*a;

cout<<a<<"*"<<a<<"*"<<a<<"="<<c<<"=";

for(i=0;i<a;i++)

{

cout<<b[i];

if(i<a-1)cout<<"+";

else cout<<endl;

}

}

return 0;

}

## 【C Language training 】 More articles on nikochus Theorem

- C Language programming 100 Examples （8）： Nicolas's Theorem
example 8 Nicolas's Theorem Title Description Nicolas's theorem can be described as : The cube of any integer can be expressed as a continuous sum of odd numbers . It should be noted that , These odd numbers must be continuous , Such as :1,3,5,7,9,…. for example , For integers 5,5*5 ...

- Huawei OJ platform —— Nicolas's Theorem
Title Description : To test the Nicolas Theorem , namely : Any integer m All the cubes can be written as m The sum of consecutive odd numbers . for example : 1^3=1 2^3=3+5 3^3=7+9+11 4^3=13+15+17+19 Input Enter a int Integers ...

- Huawei OJ The nikochus theorem of
Topic details : To test the Nicolas Theorem , namely : Any integer m All the cubes can be written as m The sum of consecutive odd numbers . for example : 1^3=1 2^3=3+5 3^3=7+9+11 4^3=13+15+17+19 Input : A plastic number Output : ...

- java Nicochos theorem of written examination
To test the Nicolas Theorem , namely : Any integer m All the cubes can be written as m The sum of consecutive odd numbers . for example : 1^3=1 2^3=3+5 3^3=7+9+11 4^3=13+15+17+19 This problem can also be inferred by mathematical formula , First item m*(m ...

- c Language training questions ： About Zhang San Li Si Wang Wu lying （ This is used here javascript Realization ）
( The first blog post ) It's boring to meet them in a communication group today , And then find some of the previous collections c Let them do the language topic , It turns out that I can't do it myself , So I spent a lot of time thinking about . The original title is : Zhang San said Li Si was lying , Li Si said Wang Wu was lying , Wang Wu said that Zhang San and Li Si ...

- About Cortez k97gprs Debug record （1）
Module debugging 1.gprs The module understands A module that uses traffic to access the Internet , You can text , Make a phone call . 2.AT Instruction Learning AT+UART= Baud rate , Flow control position , Data bit length , Calibration control , Stop bit length AT+NET=TCP/UDP choice ,APN ...

- [Thinkbayes] Bayesian thinking reading notes -1- Bayes theorem
Using Bayes Theorem , For now, the most important thing is to assume that . That is, the unknown event is known , At the same time, we should also pay attention to the whole process of hypothesis , You can't start with a new hypothesis , This assumption is often incomplete . There are two ways to make assumptions that I have found myself , One is naming , One is timing . The whole process ...

- [ turn ]100 A classic C Language program （ Puzzle questions ）
Catalog : 1. Drawing cosine curves 2. Drawing cosine curves and lines 3. Draw the circle 4. Pop star Grand Prix 5. Find the maximum number 6. The mantissa of higher power numbers 8. How much do you know about book borrowing programs 9. Yanghui triangle 10. Number conversion 11. Fish or net 12. Catch up with traffic accidents ...

- 【 Algorithm 】C Language fun programming, programming, a hundred examples of refinement
C Language fun programming, programming, a hundred examples of refinement C/C++ Language classics . practical . Interesting programming, a hundred examples of programming (1) https://wenku.baidu.com/view/b9f683c08bd63186bcebbc3c. ...

## Random recommendation

- webapi aspose export excel form
API adopt get request , Notice the use of a [FromUri] characteristic , send GET Receive entity parameters /// <summary> /// export /// </summary> /// <par ...

- Activator.CreateInstance Method (Type) Usage of
from :http://www.cnblogs.com/lmfeng/archive/2012/01/30/2331666.html Activator.CreateInstance Method (Type) ...

- JVM --java Structure analysis of bytecode
Java The main structure of the bytecode file is divided into the following parts :Class File header . Constant pool area . Description of the current class . Field list . Method list . Property list . Class File header Any class The first four bytes of the file are CA FE ...

- Some fields in the database are null when , Feedback to the page is nothing ？ How to use a 【 nothing 】 Words instead of ？
<asp:ListView ID="listViewCustomer" DataSourceID="ods_Customer" runat="s ...

- Turn on windows Of admin+ Turn on tel+ Power Supply + Remote function
1. Control panel Small icons Program function Open and close windows function Turn on Telnet You can choose both of them 2. start-up tel service Control panel Small icons Management tools service find t ...

- About this The understanding of the
var o = { a:10, b:{ a:12, fn:function(){ console.log(this.a); //undefined console.log(this); //windo ...

- HDU 2199 Can you solve this equation（ Two points answer ）
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...

- [Offer harvest ] Programming practice competition 23-freeloop
A. H Country id number I dfs Naked topic . Time complexity \(O(n^k)\). #include <bits/stdc++.h> #define FOR(i,a,b) for (int i=a; ...

- Struts2 Custom tag 2 Customize one by class id Find out the students in the class , Put it in the value stack , And traverse it .
Struts2 The process concept of custom tags : (1) You need two classes : The tag class ( Inherit the corresponding tag class ), Basic categories ( Inherit Component). Tag class is specially responsible for getting some attributes of user input from the client , This ordinary jsp Like custom tags , take ...

- crs_register/crs_unregister Registration and removal RAC service --zhuanzai
crs_register The main purpose of the command is to register resources to CRS. This method usually combines crs_stat -p perhaps crs_profile Create a profile first . meanwhile crs_register There are also updates CRS The function of . This article will describe cr ...