Analytical solution
I haven't read all the posts, but here is my analytical solution, it is writen in python3, but it should also work with python2 if you change the print-function:
###############################################################
al=[]
s=0 # summ
# The Array "al" is...