login
a(n) = sum of the first n primes which are coprime to n.
1

%I #9 Oct 10 2019 14:03:26

%S 2,8,14,26,36,72,70,98,126,190,186,276,268,372,432,438,484,634,620,

%T 784,864,950,940,1156,1156,1356,1368,1584,1564,1978,1820,1986,2262,

%U 2408,2572,2742,2710,3066,3250,3440,3406,4016,3788,4214,4430,4636,4614,5112

%N a(n) = sum of the first n primes which are coprime to n.

%e The first 6 primes which are coprime to 6 are 5,7,11,13,17,19. So a(6)=5+7+11+13+17+19 = 72.

%t f[n_] := Block[{c = n, k = 0, p, s = 0},While[c > 0,k++;While[p = Prime[k]; GCD[p, n] > 1, k++ ];c--;s += p;];s];Table[f[n], {n, 50}] (* _Ray Chandler_, Dec 14 2006 *)

%Y Cf. A119993, A125903.

%K nonn

%O 1,1

%A _Leroy Quet_, Dec 13 2006

%E Extended by _Ray Chandler_, Dec 14 2006