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.

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.

Original entry on oeis.org

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, 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, 72, 1, 2, 2, 4, 2, 10, 24, 18, 52
Offset: 1

Views

Author

S. Brunner, Feb 14 2023

Keywords

Comments

When a location is visited more than once, each such visit counts in a(n).
a(0)=0 is no terms before n=0 so an empty path.

Examples

			For n=6, the following is the longest chain of jumps starting from i = n-1 = 5,
  1  2  3  4  5   location number i
  0, 3, 1, 2, 2   a(i)
        1<----
         ->2
     3<----
      ------->2
        1<----
         ->2
     3<----
      ------->2
        1<----
         ->2
     3<----
It visited the terms 2,1,2,3 three times in a loop, which gives a total of 12 terms, so a(6)=12.
		

Crossrefs

Cf. A360593.

Programs

  • Python
    def A(lastn,times=3,mode=0):
      a,n=[0],0
      while n0:
          if len(d[-1])>v: v,o=len(d[-1]),d[-1][:]
          if d[-1][-1]-a[d[-1][-1]]>=0:
            if d[-1].count(d[-1][-1]-a[d[-1][-1]])0: d.append(d[-1][:])
              d[-1].append(d[-1][-1]+a[d[-1][-1]])
              r=1
          if g>0:
            if r>0: d[-2].append(d[-2][-1]-a[d[-2][-1]])
            else: d[-1].append(d[-1][-1]-a[d[-1][-1]])
            r=1
          if r==0: d.pop()
          r,g=0,0
        a.append(v)
        n+=1
        if mode==0: print(n+1,a[n])
        if mode>0:
          u,q=0,[]
          while u