ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 10 Aug 2018 15:57:42 +0200How can I find the sum of first 20 positive perfect square?https://ask.sagemath.org/question/43311/how-can-i-find-the-sum-of-first-20-positive-perfect-square/Hi! First post!
When I type " k^2 for k in [1..20] ",
it says
" k**Integer(2) for k in (ellipsis_range(Integer(1),Ellipsis,Integer(20)))
^
SyntaxError: invalid syntax "
What can I type?
pizzaFri, 10 Aug 2018 15:57:42 +0200https://ask.sagemath.org/question/43311/How to sum numbers on a list?https://ask.sagemath.org/question/42773/how-to-sum-numbers-on-a-list/ Hi, I'm stuck at this problem:
**Create the SC20 list with the sums of the squares of the 20 first positive integers**
I know that if I want to do a list with the squares of the 20 first positive integers I have to do this:
[(x+1)^2 for x in range(20)]
And I'll get this:
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400]
But I don't know how to do it with the sums:
Basically, what I want to get is this:
[5,14,30,55,...]
Do you know how to do it?
Thanks in advance.
P.S. Sorry for my English.NorraimonFri, 29 Jun 2018 17:39:18 +0200https://ask.sagemath.org/question/42773/