+ 1

# 1+8+27..........1000

Code for program in java

15th Feb 2020, 5:59 PM
Deepika Sudan
6 ответов
+ 7
Actually that has a cool formula. Let's start with a simple example: 1^3 + 2^3 = 1 + 8 = 9 We got a square: 9 = 3^2 1^3 + 2^3 + 3^3 = 1 + 8 + 27 = 36 We got another square: 36 = 6^2 And: 1 + 2 = 3 1 + 2 + 3 = 6 Because: 1^3 + 2^3 = (1 + 2)^2, 1^3 + 2^3 + 3^3 = (1 + 2 + 3)^2, 1^3 + 2^3 + 3^3 + 4^3 = (1 + 2 + 3 + 4)^2 and etc. are true, we can conclude that it is true for all: 1^3 + 2^3 + 3^3 + ... + n^3 = (1 + 2 + 3 + ... + n)^2 (1, 2, 3, ... n) is an arithmetic sequence, and arithmetic sequence a has a function, which can be used to calculate the sum of a certain range: n*(a_1 + a_n)/2 So we can calculate the sum of the sequence: s = n*(1 + n)/2 And we'll get a formula to calculate those cube sequences: (n*(1 + n)/2)^2 What is 1^3 + 2^3 + 3^3 + ... + 100^3? Answer: (100*(1 + 100)/2)^2 = 25'502'500 I can't prove why: 1^3 + 2^3 + 3^3 + ... + n^3 = (1 + 2 + 3 + ... + n)^2 But if someone can prove it without Google I would appreciate it. https://www.sololearn.com/post/150295/?ref=app
15th Feb 2020, 7:27 PM
Seb TheS
+ 1
Can you show us your attempt?
15th Feb 2020, 6:09 PM
Aymane Boukrouh
+ 1
15th Feb 2020, 6:10 PM
Deepika Sudan
+ 1