OFFSET
0,6
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
EXAMPLE
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.
MATHEMATICA
f[l_List] := Append[l, Length[Select[l + Length[l], IntegerQ[Sqrt[8# + 1]] &]]]; Nest[f, {0}, 100] (* Ray Chandler, Oct 16 2006 *)
PROG
(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
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Leroy Quet, Oct 14 2006
EXTENSIONS
More terms from Ray Chandler and Klaus Brockhaus, Oct 16 2006
STATUS
approved