Home > Back-end >  The programming calculation
The programming calculation

Time:11-05

S=1 + (1 + 3) + (1 + 3 + 5) +... + (1 + 3 +... 51) write code, solving!!!!!

CodePudding user response:

Can be directly calculated, S=1 + (1 + 3) + (1 + 3 + 5) +... Is actually S ^ 2=1 + 2 ^ 2 + 3 ^ 2...=n (n + 1) (2 n + 1)/6, here n=(51 + 1)/2=26, so it is S 6201
  • Related