Since the question has a Fortran tag, here is Wolfgang's solution in Fortran:
implicit none
integer, parameter :: dp = kind(0.d0)
complex(dp), parameter :: i_ = (0, 1)
real(dp) :: alpha = 1
complex(dp) :: s = 0
integer :: k
do k = 1, 10000000
s = s + ((i_+1)/sqrt(2._dp))**k * k**(-alpha)
if (modulo(k, 1000000) == 0) print *, k, s
end do
end
Result are:
$ gfortran -O3 x.f90
$ time ./a.out
1000000 ( 0.26740049836809593 , 1.1780960379893362 )
2000000 ( 0.26740024836936921 , 1.1780966415427796 )
3000000 ( 0.26740016503629038 , 1.1780968427272547 )
4000000 ( 0.26740012336968905 , 1.1780969433194985 )
5000000 ( 0.26740009836973161 , 1.1780970036749265 )
6000000 ( 0.26740008170307927 , 1.1780970439117682 )
7000000 ( 0.26740006979833991 , 1.1780970726523770 )
8000000 ( 0.26740006086978074 , 1.1780970942078899 )
9000000 ( 0.26740005392532235 , 1.1780971109732488 )
10000000 ( 0.26740004836978204 , 1.1780971243856078 )
real 0m1.477s
user 0m1.472s
sys 0m0.000s
For comparison, on my computer the C++ code takes:
$ g++ -O3 x.cc
$ time ./a.out
1000000 (0.2674004983680959,1.178096037989336)
2000000 (0.2674002483693692,1.17809664154278)
3000000 (0.2674001650362904,1.178096842727255)
4000000 (0.267400123369689,1.178096943319499)
5000000 (0.2674000983697316,1.178097003674927)
6000000 (0.2674000817030793,1.178097043911768)
7000000 (0.2674000697983399,1.178097072652377)
8000000 (0.2674000608697807,1.17809709420789)
9000000 (0.2674000539253223,1.178097110973249)
real 0m2.123s
user 0m2.116s
sys 0m0.004s
I use gcc 4.6.3.