Defined function Nicoqish(x) Return and for x The first and last values of consecutive odd numbers , A number may be written as multiple sets of continuous odd numbers and , Only the group of information with the smallest initial odd number is required to be returned . Input data in the main module n Before calling function output n Number dependent formula .
Input
One [1,20] Integer between n
Output
[1,n] Multiple line Expressions related to integers in the range
The sample input
5
Sample output
1^3=1
2^3=3+5
3^3=7+9+11
4^3=1+3+5+7+9+11+13+15
5^3=21+23+25+27+29
def Nicoqish(x):
k = x**3
i = 1
while i <= k:
s = 0
j = i # j>=i
while s<=k:
s += j
if s==k:
return i,j
j += 2
i+=2