%I #13 Oct 26 2017 14:36:14
%S 0,1,1,1,0,3,2,1,1,5,3,0,2,2,5,3,2,0,3,4,5,4,0,3,2,5,5,5,5,0,0,7,2,5,
%T 6,5,7,0,2,1,9,2,5,8,6,8,1,2,2,2,10,2,5,12,8,8,1,1,4,2,2,11,3,6,14,9,
%U 9,1,1,3,4,2,3,11,4,8,15,12,8,2,2,1,3,6,2,4,11,6,9,18,13,9,1,2,3,1,5,6,2,6
%N a(n) = number of earlier terms each of which, when added to n, give a triangular number.
%H G. C. Greubel, <a href="/A123396/b123396.txt">Table of n, a(n) for n = 0..1000</a>
%e a(0)+10 = 10, a(1)+10 = 11, a(2)+10 = 11, a(3)+10 = 11, a(4)+10 = 10, a(5)+10 = 13, a(6)+10 = 12, a(7)+10 = 11, a(8)+10 = 11 and a(9)+10 = 15. Of these, three terms (a(0), a(4), a(9)) are such that, when each is added to 10, the result is a triangular number (i.e. of the form m(m+1)/2). Hence a(10) = 3.
%t f[l_List] := Append[l, Length[Select[l + Length[l], IntegerQ[Sqrt[8# + 1]] &]]];Nest[f, {0}, 100] (* _Ray Chandler_, Oct 16 2006 *)
%o (PARI) {m=100; v=vector(m+1); print1(v[1]=0,","); for(n=1,m,c=0; for(k=1,n, a=n+v[k];b=sqrtint(2*a);if(b*(b+1)/2==a,c++));print1(v[n+1]=c,","))} \\ _Klaus Brockhaus_, Oct 16 2006
%Y Cf. A000217.
%K easy,nonn
%O 0,6
%A _Leroy Quet_, Oct 14 2006
%E More terms from _Ray Chandler_ and _Klaus Brockhaus_, Oct 16 2006