ind the consecutive odd whose sum is equal to n**3

27 views Asked by At

It is known that each number of the form n**3 is equal to the sum of consecutive odd n. For instance: enter image description here

Given an integer m, m, > 0, find the consecutive odd whose sum is equal to n**3, for n assuming values from 1 to m.

I did this code:

enter image description here

I'm sorry for the comments being in Portuguese because I'm Brazilian.

Could he stick with a better logic or leaner?

The code is above. Could he stick with a better logic or leaner?

I built a list with the limit of 1000 integers, then iterated on the odd list.

enter image description here

0

There are 0 answers