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
23 + 43 + 63 + ……… + (2n)3
Even Sum = 23 + 43 + 63 + .... + (2n)3 if we multiply by 23 then = 23 x (13 + 23 + 32 + .... + (n)3) = 23 + 43 + 63 + ......... + (2n)3 = 23 (n(n+1)/2)2 = 8(n(n+1))2/4 = 2(n(n+1))2
Sum of cube of first 4 even numbers = 23 + 43 + 63 + 83 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
Sum of cube of first n odd natural numbers
We need to compute 13 + 33 + 53 + …. + (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 = n2(2n+1)2 - 2* n2(n+1)2 = n2[(2n+1)2 - 2*(n+1)2] = n2[4n2 + 1 + 4n - 2n2 - 2 - 4n] = n2(2n2 - 1)
Sum of cube of first 4 odd numbers = 13 + 33 + 53 + 73 put n = 4 = n2(2n2 - 1) = 42(2*(4)2 - 1) = 16(32-1) = 496 1 + 27 + 125 + 343 = 496
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Sum of cubes of first n odd natural numbers
- Difference between Sum of Cubes and Sum of First N Natural Numbers
- Count numbers from given range having odd digits at odd places and even digits at even places
- Sum of alternating sign cubes of first N Natural numbers
- Sum of range in a series of first odd then even natural numbers
- Average of Cubes of first N natural numbers
- Sum of cubes of first n even numbers
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Check if a number has an odd count of odd divisors and even count of even divisors
- Minimum value of K such that sum of cubes of first K natural number is greater than equal to N
- Count set bits in the Kth number after segregating even and odd from N natural numbers
- Count of N-digit Numbers having Sum of even and odd positioned digits divisible by given numbers
- Sum of all odd natural numbers in range L and R
- Numbers less than N that are perfect cubes and the sum of their digits reduced to a single digit is 1
- Sum of fourth powers of first n odd natural numbers
- Sum of fourth power of first n even natural numbers
- Count numbers in given range such that sum of even digits is greater than sum of odd digits
- Sum of elements in range L-R where first half and second half is filled with odd and even numbers
- Generate an array of given size with equal count and sum of odd and even numbers
- Count total number of N digit numbers such that the difference between sum of even and odd digits is 1
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.