# Sum of cubes of even and odd natural numbers

We know that sum of cubes of first n natural numbers is = (n(n+1)/2)^{2}.

** Sum of cube of first n even natural numbers **

2^{3} + 4^{3} + 6^{3} + ……… + (2n)^{3}

Even Sum = 2^{3}+ 4^{3}+ 6^{3}+ .... + (2n)^{3}if we multiply by 2^{3}then = 2^{3}x (1^{3}+ 2^{3}+ 3^{2}+ .... + (n)^{3}) = 2^{3}+ 4^{3}+ 6^{3}+ ......... + (2n)^{3}= 2^{3}(n(n+1)/2)^{2}= 8(n(n+1))^{2}/4 = 2(n(n+1))^{2}

**Example : **

Sum of cube of first 4 even numbers = 2^{3}+ 4^{3}+ 6^{3}+ 8^{3}put n = 4 = 2(n(n+1))^{2}= 2*(4*(4+1))^{2}= 2(4*5)^{2}= 2(20)^{2}= 800 8 + 64 + 256 + 512 = 800

Program for Sum of cubes of first n even numbers

**Sum of cube of first n odd natural numbers **

We need to compute 1^{3} + 3^{3} + 5^{3} + …. + (2n-1)^{3}

OddSum = (Sum of cubes of all 2n numbers) - (Sum of cubes of first n even numbers) = (2n(2n+1)/2)^{2}- 2(n(n+1))^{2}= n^{2}(2n+1)^{2}- 2* n^{2}(n+1)^{2}= n^{2}[(2n+1)^{2}- 2*(n+1)^{2}] = n^{2}[4n^{2}+ 1 + 4n - 2n^{2}- 2 - 4n] = n^{2}(2n^{2}- 1)

**Example : **

Sum of cube of first 4 odd numbers = 1^{3}+ 3^{3}+ 5^{3}+ 7^{3}put n = 4 = n^{2}(2n^{2}- 1) = 4^{2}(2*(4)^{2}- 1) = 16(32-1) = 496 1 + 27 + 125 + 343 = 496

Program for Sum of cubes of first n odd numbers

## Recommended Posts:

- Sum of cubes of first n odd natural numbers
- Sum of cubes of first n even numbers
- Numbers less than N that are perfect cubes and the sum of their digits reduced to a single digit is 1
- LCM of First n Natural Numbers
- Sum of sum of first n natural numbers
- Natural Numbers
- Sum of first N natural numbers which are divisible by X or Y
- Sum of all odd natural numbers in range L and R
- Sum of first N natural numbers which are divisible by 2 and 7
- Sum of first N natural numbers which are not powers of K
- Sum of all natural numbers in range L to R
- Sum of squares of first n natural numbers
- Sum of squares of first n natural numbers
- Average of first n even natural numbers
- Sum of kth powers of first n natural numbers

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.