OFFSET
2,1
COMMENTS
LINKS
Alois P. Heinz, Table of n, a(n) for n = 2..65536
J. S. Myers, R. Schroeppel, S. R. Shannon, N. J. A. Sloane, and P. Zimmermann, Three Cousins of Recaman's Sequence, arXiv:2004:14000 [math.NT], April 2020.
MAPLE
a:= proc(n) local h, j; h:= n*(n+1); for j from n+1 do
if issqr(1+4*(j*(j+1)-h)) then return j fi od
end:
seq(a(n), n=2..70); # Alois P. Heinz, Jul 31 2019
MATHEMATICA
a[n_] := Module[{h = n(n+1), j}, For[j = n+1, True, j++, If[IntegerQ[ Sqrt[1 + 4 (j(j+1) - h)]], Return[j]]]];
a /@ Range[2, 70] (* Jean-François Alcover, Jun 05 2020, after Maple *)
PROG
(PARI) for(n=2, 100, t=n*(n+1)/2; for(k=1, 10^9, u=t+k*(k+1)/2; v=floor(sqrt(2*u)); if(v*(v+1)/2==u, print1(v", "); break)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Ralf Stephan, Apr 06 2003
STATUS
approved