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 A360595 #28 Jul 20 2023 07:23:28 %S A360595 0,3,1,2,2,12,1,2,2,4,2,10,15,1,2,2,4,2,10,20,1,2,2,4,2,10,13,8,2,10, %T A360595 2,15,7,15,25,17,53,1,2,2,4,2,10,65,1,2,2,4,2,10,13,8,2,10,2,15,7,15, %U A360595 72,1,2,2,4,2,10,24,18,52 %N A360595 a(n) is the maximum number of locations 1..n-1 which can be visited in a single path starting from i = n-1, where jumps from location i to i +- a(i) are permitted (within 1..n-1) and a term can be visited up to three times. %C A360595 When a location is visited more than once, each such visit counts in a(n). %C A360595 a(0)=0 is no terms before n=0 so an empty path. %e A360595 For n=6, the following is the longest chain of jumps starting from i = n-1 = 5, %e A360595 1 2 3 4 5 location number i %e A360595 0, 3, 1, 2, 2 a(i) %e A360595 1<---- %e A360595 ->2 %e A360595 3<---- %e A360595 ------->2 %e A360595 1<---- %e A360595 ->2 %e A360595 3<---- %e A360595 ------->2 %e A360595 1<---- %e A360595 ->2 %e A360595 3<---- %e A360595 It visited the terms 2,1,2,3 three times in a loop, which gives a total of 12 terms, so a(6)=12. %o A360595 (Python) %o A360595 def A(lastn,times=3,mode=0): %o A360595 a,n=[0],0 %o A360595 while n<lastn: %o A360595 d,i,v,o,g,r=[[n]],0,1,[],0,0 %o A360595 while len(d)>0: %o A360595 if len(d[-1])>v: v,o=len(d[-1]),d[-1][:] %o A360595 if d[-1][-1]-a[d[-1][-1]]>=0: %o A360595 if d[-1].count(d[-1][-1]-a[d[-1][-1]])<times:g=1 %o A360595 if d[-1][-1]+a[d[-1][-1]]<=n: %o A360595 if d[-1].count(d[-1][-1]+a[d[-1][-1]])<times: %o A360595 if g>0: d.append(d[-1][:]) %o A360595 d[-1].append(d[-1][-1]+a[d[-1][-1]]) %o A360595 r=1 %o A360595 if g>0: %o A360595 if r>0: d[-2].append(d[-2][-1]-a[d[-2][-1]]) %o A360595 else: d[-1].append(d[-1][-1]-a[d[-1][-1]]) %o A360595 r=1 %o A360595 if r==0: d.pop() %o A360595 r,g=0,0 %o A360595 a.append(v) %o A360595 n+=1 %o A360595 if mode==0: print(n+1,a[n]) %o A360595 if mode>0: %o A360595 u,q=0,[] %o A360595 while u<len(o): %o A360595 q.append(a[o[u]]) %o A360595 u+=1 %o A360595 print(n+1,a[n],q,o) %o A360595 return a %Y A360595 Cf. A360593. %K A360595 nonn %O A360595 1,2 %A A360595 _S. Brunner_, Feb 14 2023