login
A137894
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.
3
1, 3, 3, 4, 7, 9, 7, 12, 9, 10, 11, 17, 13, 21, 21, 16, 17, 27, 19, 38, 21, 33, 23, 24, 25, 39, 27, 28, 41, 30, 31, 48, 33, 51, 49, 51, 37, 57, 39, 40, 41, 63, 43, 44, 63, 69, 47, 72, 49, 75, 51, 52, 53, 81, 77, 84, 57, 78, 59, 90, 61, 93, 63, 64, 91, 99, 67, 68, 69, 99
OFFSET
1,2
LINKS
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
KEYWORD
easy,nonn
AUTHOR
Ctibor O. Zizka, Apr 30 2008
EXTENSIONS
More terms from Alex Ratushnyak, Nov 22 2013.
STATUS
approved