login
a(n) = sum of odd k in 1..n for which Kronecker(k,n)=1.
2

%I #17 Nov 27 2017 00:36:16

%S 1,1,1,4,1,6,1,8,13,13,18,8,13,31,1,64,38,25,50,40,23,78,26,24,124,

%T 131,65,84,83,94,66,128,103,158,143,216,137,212,42,160,224,156,242,

%U 176,132,327,147,176,513,297,259,312,303,246,170,224,303,365,509,240

%N a(n) = sum of odd k in 1..n for which Kronecker(k,n)=1.

%p A232597 := proc(n)

%p local a;

%p a := 0 ;

%p for k from 1 to n by 2 do

%p if numtheory[jacobi](k,n) = 1 then

%p a := a+k ;

%p end if;

%p end do:

%p a ;

%p end proc: # _R. J. Mathar_, May 25 2017

%o (PARI)

%o A232597(n) = {s=0; for(k=1, n, s=s+((k%2)*((1+kronecker(k, n))\2)*k)); return(s); }

%o for(n=1, 60, print1(A232597(n), ", "))

%o (PARI) a(n)=my(s); forstep(k=1,n,if(kronecker(k,n)==1, s+=k)); s \\ _Charles R Greathouse IV_, Nov 26 2013

%Y Restricted to primes: A232505(n) = a(A000040(n)). Cf. also A228131.

%K nonn

%O 1,4

%A _Antti Karttunen_, Nov 26 2013