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 A317742 #17 Aug 19 2018 15:55:49 %S A317742 1,0,1,0,1,0,1,0,1,0,1,2,1,0,1,0,1,0,1,2,3,2,1,2,1,2,3,2,1,0,1,0,1,0, %T A317742 1,2,3,4,3,2,1,2,3,2,3,4,5,6,5,4,3,2,3,2,1,2,3,4,3,2,1,0,1,0,1,0,1,2, %U A317742 3,4,5,4,3,2,1,2,3,4,5,4,5,6,7,8,9,10,9,8,7,6,5,4,3,4,5,6,5,4,3,4,5,6,7,8,9,10 %N A317742 Let b(1) = b(2) = 1; for n >= 3, b(n) = b(t(n)) + b(n-t(n)) where t = A287422. a(n) = 2*b(n) - n. %C A317742 This sequence has fractal-like structure as A004074, although there are substantial differences of this sequence based on slow A287422 and b(n) sequences. See plots of this sequence and A004074 in Links section. %H A317742 Altug Alkan, <a href="/A317742/b317742.txt">Table of n, a(n) for n = 1..16384</a> %H A317742 Altug Alkan, <a href="/A317742/a317742.png">Line plots of a(n) and A004074(n) for n <= 2^15</a> %p A317742 t:= proc(n) option remember; `if`(n<3, 1, %p A317742 n -t(t(n-1)) -t(n-t(n-1))) %p A317742 end: %p A317742 b:= proc(n) option remember; `if`(n<3, 1, %p A317742 b(t(n)) +b(n-t(n))) %p A317742 end: %p A317742 seq(2*b(n)-n, n=1..100); # after _Alois P. Heinz_ at A317686 %t A317742 Block[{t = NestWhile[Function[{a, n}, Append[a, n - a[[a[[-1]] ]] - a[[-a[[-1]] ]] ] ] @@ {#, Length@ # + 1} &, {1, 1}, Last@ # < 10^2 &], b}, b = NestWhile[Function[{b, n}, Append[b, b[[t[[n]] ]] + b[[-t[[n]] ]] ] ] @@ {#, Length@ # + 1} &, {1, 1}, Last@ # < Max@ t &]; Array[2 b[[#]] - # &, Length@ b] ] (* _Michael De Vlieger_, Aug 07 2018 *) %t A317742 t[n_] := t[n] = If[n<3, 1, n - t[t[n-1]] - t[n - t[n-1]]]; b[n_] := b[n] = If[n<3, 1, b[t[n]] + b[n - t[n]]]; Table[2*b[n] - n, {n, 106}] (* _Giovanni Resta_, Aug 14 2018 *) %o A317742 (PARI) t=vector(199); t[1]=t[2]=1; for(n=3, #t, t[n] = n-t[n-t[n-1]]-t[t[n-1]]); b=vector(199); b[1]=b[2]=1; for(n=3, #b, b[n] = b[t[n]]+b[n-t[n]]); vector(199, k, 2*b[k]-k) %Y A317742 Cf. A004074, A287422, A317648, A317686. %K A317742 nonn,look %O A317742 1,12 %A A317742 _Altug Alkan_, Aug 05 2018