cp's OEIS Frontend

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.

A360593 Each term a(i) can reach a(i+a(i)) and a(i-a(i)) if these terms exist. a(n) is the greatest number of terms among a(1..n-1) that can be reached by starting at a(n-1) and visiting no term more than once; a(0)=0. See example.

This page as a plain text file.
%I A360593 #45 Feb 25 2023 08:20:17
%S A360593 0,1,2,2,4,2,6,2,7,5,6,6,9,10,10,6,8,7,9,8,11,8,12,14,12,14,19,16,19,
%T A360593 14,14,16,14,21,14,16,21,14,14,16,14,18,14,16,21,21,19,21,22,22,21,23,
%U A360593 24,24,29,29,22,26,24,28,24,26,31,24,31,34,24,30,34,29,39
%N A360593 Each term a(i) can reach a(i+a(i)) and a(i-a(i)) if these terms exist. a(n) is the greatest number of terms among a(1..n-1) that can be reached by starting at a(n-1) and visiting no term more than once; a(0)=0. See example.
%C A360593 For clarification:
%C A360593 The terms of the sequence so far are written as a one-dimensional grid, and from every term a(i) you can jump back or forth a(i) terms, without i getting < 0 or > n, as these terms don't exist. Then search for the longest possible chain of jumps you can do starting at a(n) and visiting no term more than once. The number of targets visited by this chain is the next term of the sequence.
%C A360593 A chain of jumps C always starts at n, with C1 = a(n-1). Then the first jump always has to go back C1 terms, so C2 = a(n-1-C1) = a(n-1-a(n-1)), and then it continues with jumping back or forth C2 terms, whichever produces the longest chain of jumps:
%C A360593 C3 = a(n-1-C1-C2) or a(n-1-C1+C2),
%C A360593 C4 = a(n-1-C1{-/+}C2{-/+}C3), etc.
%C A360593 The first numbers which appear to be missing from this sequence are:
%C A360593 3, 13, 15, 17, 20, 25, 27,  32,  33, 36, 43, 44, 48,  50, 51,  62, 63,  69, 70, 71, 75, 77, 78, 80, etc.
%H A360593 S. Brunner, <a href="/A360593/b360593.txt">Table of n, a(n) for n = 0..217</a>
%e A360593 This example shows the longest chain of jumps starting with a(7)=2:
%e A360593 0, 1, 2, 2, 4, 2, 6, 2
%e A360593    1<----2<----2<----2
%e A360593     ->2---->4
%e A360593 0<----------
%e A360593 It visited the 7 terms 2,2,2,1,2,4,0. So a(8)=7.
%o A360593 (Python)
%o A360593 def A(lastn,times=1,mode=0):
%o A360593   a,n=[0],0
%o A360593   while n<lastn:
%o A360593     d,i,v,o,g,r=[[n]],0,1,[],0,0
%o A360593     while len(d)>0:
%o A360593       if len(d[-1])>v: v,o=len(d[-1]),d[-1][:]
%o A360593       if d[-1][-1]-a[d[-1][-1]]>=0:
%o A360593         if d[-1].count(d[-1][-1]-a[d[-1][-1]])<times:g=1
%o A360593       if d[-1][-1]+a[d[-1][-1]]<=n:
%o A360593         if d[-1].count(d[-1][-1]+a[d[-1][-1]])<times:
%o A360593           if g>0: d.append(d[-1][:])
%o A360593           d[-1].append(d[-1][-1]+a[d[-1][-1]])
%o A360593           r=1
%o A360593       if g>0:
%o A360593         if r>0: d[-2].append(d[-2][-1]-a[d[-2][-1]])
%o A360593         else: d[-1].append(d[-1][-1]-a[d[-1][-1]])
%o A360593         r=1
%o A360593       if r==0:d.pop()
%o A360593       r,g=0,0
%o A360593     a.append(v)
%o A360593     n+=1
%o A360593     if mode==0: print(n,a[n])
%o A360593     if mode>0:
%o A360593       u,q=0,[]
%o A360593       while u<len(o):
%o A360593         q.append(a[o[u]])
%o A360593         u+=1
%o A360593       print(n,a[n],q,o)
%o A360593   return a
%Y A360593 Cf. A360594, A360595, A360744, A360745, A360746.
%K A360593 nonn
%O A360593 0,3
%A A360593 _S. Brunner_, Feb 13 2023