OFFSET
1,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
FORMULA
Limiting sequence when we start with positive integers (A000027) and at step n >= 1 add to the term at position n + a(n) the value n.
MAPLE
mx:= 10000: # maximal index needed
b:= proc(n) n end:
a:= proc(n) option remember; global mx; local h, t;
if n=0 then 0 else a(n-1); t:= b(n);
if n+t<=mx then h:=b(t+n); b(t+n):=h+n fi; t
fi
end:
seq(a(n), n=1..100); # Alois P. Heinz, Mar 04 2015
MATHEMATICA
mx = 10000 (* maximal index needed *); b[n_] := n; a[n_] := a[n] = Module[{h, t}, If[n == 0, 0, a[n-1]; t = b[n]; If[n+t <= mx, h = b[t+n]; b[t+n] = h+n]; t]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Oct 24 2016, after Alois P. Heinz *)
PROG
(Python)
TOP = 1000
a = [1]*TOP
for n in range(1, TOP):
a[n]=n
for n in range(1, TOP):
print(str(a[n]), end=', ')
if n+a[n]<TOP: a[n+a[n]] += n
# Alex Ratushnyak, Nov 22 2013
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Ctibor O. Zizka, Apr 30 2008
EXTENSIONS
More terms from Alex Ratushnyak, Nov 22 2013.
STATUS
approved