This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A336604 #57 Oct 25 2020 08:37:06 %S A336604 1,2,3,5,8,13,26,27,29,32,37,50,50,51,53,56,61,74,125,125,126,128,131, %T A336604 136,149,200,200,201,203,206,211,224,275,275,276,278,281,286,299,350, %U A336604 350,351,353,356,361,374,425,425,426,428,431,436,449,500,936,936,937,939,942,947,960,1011 %N A336604 a(0) = 1, a(1) = 2; thereafter let x = (a(n-1) mod a(n-2)); then a(n) = a(n-1) + a(x) if x < n, otherwise a(n) = a(n-1). %H A336604 N. J. A. Sloane, <a href="/A336604/b336604.txt">Table of n, a(n) for n = 0..20000</a> %e A336604 a(7) = 27, a(8) = 29, so a(9) = 29 + a(29 mod 27) = 32. %p A336604 a:= proc(n) option remember; `if`(n<2, n+1, (x-> %p A336604 a(n-1)+`if`(x<n, a(x), 0))(a(n-1) mod a(n-2))) %p A336604 end: %p A336604 seq(a(n), n=0..100); # _Alois P. Heinz_, Oct 25 2020 %t A336604 a[0] = 1; a[1] = 2; a[n_] := a[n] = a[n - 1] + If[(r = Mod[a[n - 1], a[n - 2]]) < n, a[r], 0]; Array[a, 51, 0] (* _Amiram Eldar_, Oct 10 2020 *) %o A336604 (C++) %o A336604 for (int i = 2; i < 10000; i++) %o A336604 { %o A336604 j = a[i - 1]; %o A336604 k = a[i - 2]; %o A336604 l = j % k; %o A336604 if (int(l) <= int(i)) a[i] = j + a[l]; else a[i] = a[i - 1]; %o A336604 } %Y A336604 Cf. A215526. %K A336604 nonn %O A336604 0,2 %A A336604 _Maxim Skorohodov_, Oct 10 2020