login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A358431
a(0) = 1; a(n+1) = 1 if a(n) > n, otherwise a(n+1) = a(n) + a(a(n)).
0
1, 1, 2, 4, 1, 2, 4, 5, 7, 12, 1, 2, 4, 5, 7, 12, 16, 32, 1, 2, 4, 5, 7, 12, 16, 32, 1, 2, 4, 5, 7, 12, 16, 32, 48, 1, 2, 4, 5, 7, 12, 16, 32, 48, 1, 2, 4, 5, 7, 12, 16, 32, 48, 55, 1, 2, 4, 5, 7, 12, 16, 32, 48, 55, 57, 62, 110, 1, 2, 4, 5, 7, 12, 16, 32, 48, 55, 57, 62, 110
OFFSET
0,3
MATHEMATICA
a[0] = 1; a[n_] := a[n] = If[a[n - 1] > n - 1, 1, a[n - 1] + a[a[n - 1]]]; Array[a, 80, 0] (* Amiram Eldar, Dec 06 2022 *)
PROG
(Python)
from functools import cache
@cache
def a(n): return 1 if n==0 else (1 if a(n-1) > n-1 else a(n-1) + a(a(n-1)))
print([a(n) for n in range(76)]) # Michael S. Branicky, Nov 15 2022
CROSSREFS
Cf. A062039.
Sequence in context: A375030 A106645 A115314 * A062039 A352866 A352883
KEYWORD
nonn
AUTHOR
Aidan Clarke, Nov 15 2022
STATUS
approved