%I #30 Nov 08 2016 22:18:28
%S 0,0,0,6,0,15,6,22,28,45,33,66,35,64,74,104,102,140,129,160,182,196,
%T 170,263,241,285,257,281,319,329,372,423,414,460,491,537,520,582,623,
%U 647,724,836,731,772,817,947,887,1062,879,834,1076
%N a(1) = 0; a(n) is the sum of m < n for which a(m) + n is not prime.
%H Peter Kagey, <a href="/A270536/b270536.txt">Table of n, a(n) for n = 1..1000</a>
%e a(1) = 0.
%e a(2) = 0 because 2 + a(1) is prime.
%e a(3) = 0 because 3 + a(i) is prime for 1 <= i <= 2.
%e a(4) = 6 because 4 + a(1), 4 + a(2), and 4 + a(3) are nonprime; 1 + 2 + 3 = 6.
%e a(5) = 0 because 5 + a(i) is prime for 1 <= i <= 4.
%o (Java)
%o public static int[] sequenceD(int n) {
%o int[] terms = new int[n];
%o terms[0] = 0;
%o terms[1] = 0;
%o for (int i = 2; i < n; i++) {
%o int count = 0;
%o for (int j = 1; j < i; j++) {
%o if (!prime(terms[j] + i)) {
%o count = count + j;
%o }
%o }
%o terms[i] = count;
%o }
%o return terms;
%o }
%o (PARI) lista(nn) = {va = vector(nn); print1(va[1], ", "); for (n=2, nn, va[n] = sum(k=1, n-1, k*(! isprime(n+va[k]))); print1(va[n], ", "););} \\ _Michel Marcus_, Mar 28 2016
%Y Cf. A270654, which is the sum of m < n for which a(m) + n is prime.
%K easy,nonn
%O 1,4
%A _Alec Jones_, Mar 28 2016