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.

Showing 1-8 of 8 results.

A360746 a(n) is the maximum number of locations 1..n-1 which can be reached starting from a(n-1), where jumps from location i to i +- a(i) are permitted (within 1..n-1); a(1)=1. See example.

Original entry on oeis.org

1, 1, 2, 3, 4, 4, 5, 5, 5, 7, 8, 8, 8, 9, 9, 12, 10, 10, 12, 10, 12, 13, 13, 13, 16, 14, 14, 16, 17, 17, 17, 18, 18, 24, 25, 25, 25, 26, 27, 27, 27, 27, 28, 28, 30, 28, 33, 28, 29, 30, 30, 30, 33, 31, 31, 31, 32, 32, 33, 33, 31, 31, 32, 33, 33, 35, 33, 37
Offset: 1

Views

Author

Neal Gersh Tolunsky, Feb 18 2023

Keywords

Examples

			a(7)=5 because we reach 5 terms starting from the most recent term a(6) (each line shows the next unvisited term(s) we can reach from the term(s) in the previous iteration):
1, 1, 2, 3, 4, 4
   1<----------4
1, 1, 2, 3, 4, 4
1<-1->2
1, 1, 2, 3, 4, 4
      2---->4
From the last iteration we can visit no new terms. We reached 5 terms, so a(7)=5:
1, 1, 2, 3, 4, 4
1  1  2     4  4
		

Crossrefs

Programs

  • PARI
    See Links section.
  • Python
    def A(lastn,mode=0):
      a,n,t=[1],0,1
      while n0:
          if not d[-1][-1] in rr:rr.append(d[-1][-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(len(rr))
        n+=1
        print(n+1,a[n])
        if mode>0: print(a)
      return a  # S. Brunner, Feb 26 2023
    

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.

Original entry on oeis.org

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, 14, 14, 16, 14, 21, 14, 16, 21, 14, 14, 16, 14, 18, 14, 16, 21, 21, 19, 21, 22, 22, 21, 23, 24, 24, 29, 29, 22, 26, 24, 28, 24, 26, 31, 24, 31, 34, 24, 30, 34, 29, 39
Offset: 0

Views

Author

S. Brunner, Feb 13 2023

Keywords

Comments

For clarification:
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.
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:
C3 = a(n-1-C1-C2) or a(n-1-C1+C2),
C4 = a(n-1-C1{-/+}C2{-/+}C3), etc.
The first numbers which appear to be missing from this sequence are:
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.

Examples

			This example shows the longest chain of jumps starting with a(7)=2:
0, 1, 2, 2, 4, 2, 6, 2
   1<----2<----2<----2
    ->2---->4
0<----------
It visited the 7 terms 2,2,2,1,2,4,0. So a(8)=7.
		

Crossrefs

Programs

  • Python
    def A(lastn,times=1,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,a[n])
        if mode>0:
          u,q=0,[]
          while u
    				

A360744 a(n) is the maximum number of locations 1..n-1 which can be reached starting from some location s, where jumps from location i to i +- a(i) are permitted (within 1..n-1); a(1)=1. See example.

Original entry on oeis.org

1, 1, 2, 3, 4, 5, 5, 6, 6, 7, 7, 9, 10, 10, 10, 11, 11, 13, 14, 14, 14, 15, 15, 15, 15, 21, 21, 21, 22, 22, 22, 23, 23, 23, 23, 24, 24, 26, 27, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 32, 32, 32, 32, 33, 33, 35, 35, 41, 42, 42, 42, 43, 43, 43, 44, 44, 45, 45, 46, 46, 46, 46, 46, 46, 47, 47, 49, 49, 51, 51, 51
Offset: 1

Views

Author

Neal Gersh Tolunsky, Feb 18 2023

Keywords

Comments

a(10)=7 is the earliest term whose solution cannot be represented by a single path in which each index is visited once.

Examples

			For a(9), we reach the greatest number of terms by starting at location s=4, which is a(4)=3. We visit 6 terms as follows (each line shows the next unvisited term(s) we can reach from the term(s) last visited):
1, 1, 2, 3, 4, 5, 5, 6
1<-------3------->5
1, 1, 2, 3, 4, 5, 5, 6
1->1<-------------5
1, 1, 2, 3, 4, 5, 5, 6
   1->2
1, 1, 2, 3, 4, 5, 5, 6
      2---->4
From the last iteration we can visit no new terms. We reached 6 terms, so a(9)=6:
1, 1, 2, 3, 4, 5, 5, 6
1  1  2  3  4     5
		

Crossrefs

Programs

  • Python
    def A(lastn,mode=0):
      a,n,t=[1],0,1
      while n0:
            if not d[-1][-1] in rr:rr.append(d[-1][-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
          if v0: print(a)
      return a ## S. Brunner, Feb 19 2023

A362248 a(n) is the number of locations 1..n-1 which can reach i=n-1, where jumps from location i to i +- a(i) are permitted (within 1..n-1); a(1)=1. See example.

Original entry on oeis.org

1, 1, 2, 3, 1, 5, 6, 7, 1, 1, 2, 11, 1, 13, 14, 15, 1, 1, 2, 3, 1, 5, 6, 23, 1, 1, 2, 27, 1, 29, 30, 31, 1, 1, 2, 3, 1, 5, 6, 7, 1, 1, 2, 11, 1, 13, 14, 47, 1, 1, 2, 3, 1, 5, 6, 55, 1, 1, 2, 59, 1, 61, 62, 63, 1, 1, 2, 3, 1, 5, 6, 7, 1, 1, 2, 11, 1, 13, 14, 15
Offset: 1

Views

Author

Neal Gersh Tolunsky, May 12 2023

Keywords

Comments

Note that location n-1 itself is counted as a term which can reach i=n-1.
Conjecture: a(n) is also the largest number such that starting point i=n can reach every previous location (with a(1)=1 and the same rule for jumps as in the current name).
A047619 appears to be the indices of 1's in this sequence.
A023758 appears to be the indices of terms for which a(n)=n-1.
A089633 appears to be the distinct values of the sequence (and its complement A158582 the missing values).
The sequence appears to consist of monotonically increasing runs of length 4.
It appears that a(A004767(n))=A100892(n) and a(A016825(n))=A100892(n)-1.

Examples

			a(6)=5 because there are 5 starting terms from which i=5 can be reached:
  1, 1, 2, 3, 1
  1->1->2---->1
We can see that i=1,2,3 and trivially 5 can reach i=5. i=4 can also reach i=5:
  1, 1, 2, 3, 1
  1<-------3
  1->1->2---->1
This is a total of 5 locations, so a(6)=5.
		

Crossrefs

Programs

  • C
    /* See links */

Extensions

a(24) onwards from Kevin Ryde, May 17 2023

A364392 a(1)=1 and thereafter a(n) is the least number of locations 1..n-1 which can be visited in a single path beginning at i=n-1, in which one proceeds from location i to i +- a(i) (within 1..n-1) until no further unvisited location is available.

Original entry on oeis.org

1, 1, 2, 3, 4, 4, 3, 6, 3, 4, 4, 6, 3, 5, 4, 7, 5, 5, 6, 6, 5, 6, 6, 6, 6, 7, 3, 8, 5, 8, 7, 5, 6, 6, 7, 7, 9, 5, 9, 7, 5, 8, 7, 8, 3, 6, 9, 9, 7, 6, 4, 6, 6, 6, 10, 7, 7, 5, 10, 3, 6, 7, 7, 8, 3, 8, 6, 5, 9, 6, 4, 9, 9, 5, 7, 6, 5, 5, 7, 5, 6, 6, 6, 7, 7, 9, 7
Offset: 1

Views

Author

Neal Gersh Tolunsky, Jul 21 2023

Keywords

Comments

The sequence is 1244 initial terms followed by a repeating block of 4925 terms so that a(n) = a(n-4925) for n >= 6170. - Kevin Ryde, Jul 31 2023

Examples

			a(13)=3 because beginning at the most recent location i=n-1=12, where a(12)=6, we can visit (the fewest possible) 3 locations in a single path as follows:
  1 2 3 4 5 6 7 8 9 10 11 12   location number i
  1,1,2,3,4,4,3,6,3, 4, 4, 6   a(i)
            <--------------6
            4-------->
At i=10, the only jump is back to 10-a(10) = 6, which was already visited, so the path stops.
		

Crossrefs

Programs

  • PARI
    \\ See links.

Extensions

More terms from Bert Dobbelaere, Jul 23 2023

A361383 a(n) is the number of locations 1..n-1 which can be reached starting from location i=a(n-1), where jumps from location i to i +- a(i) are permitted (within 1..n-1); a(1)=1. See example.

Original entry on oeis.org

1, 1, 2, 3, 3, 4, 5, 4, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 15, 16, 15, 16, 15, 18, 17, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 22, 24, 22, 24, 23, 24, 26, 26, 26, 26, 26, 26, 26, 26, 26, 29, 32, 33, 35, 32, 35, 32, 35, 32, 35, 32, 35, 32, 36, 35, 37
Offset: 1

Views

Author

Neal Gersh Tolunsky, Mar 09 2023

Keywords

Comments

For clarification: We start at the term with index a(n-1). From each term at index i, we can jump to up to two locations, which are a(i) terms away in either direction. We continue this process from the terms we have reached until we have visited all possible terms.

Examples

			We find a(8)=4 by first looking at the previous term in the sequence so far (1,1,2,3,3,4,5), which is a(7)=5. This tells us to start at location i=5. Permitted steps can reach 4 locations as follows:
  1, 1, 2, 3, 3, 4, 5
     1<-------3
  1, 1, 2, 3, 3, 4, 5
  1<-1->2
Steps from each of these locations cannot reach anything new, so a(8)=4. The reachable terms are:
  1, 1, 2, 3, 3, 4, 5
  1  1  2     3
		

Crossrefs

Extensions

More terms from Samuel Harkness, Mar 10 2023

A367128 a(1)=a(2)=1; thereafter a(n) is the radius of the sequence's digraph, where jumps from location i to i+-a(i) are permitted (within 1..n-1).

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10
Offset: 1

Views

Author

Neal Gersh Tolunsky, Nov 05 2023

Keywords

Comments

The radius of the sequence's digraph is the smallest eccentricity of any vertex (location) in the graph. The eccentricity of a location i means the largest number of jumps in the shortest path from location i to any other location.

Examples

			To find a(5), we can look at the eccentricity of each location:
  i            = 1     2     3     4
  a(i)         = 1,    1,    1,    1
                 1 <-> 1 <-> 1 <-> 1
  eccentricity = 3     2     2     3
i=1 has eccentricity 3 because it requires up to 3 jumps to reach any other location (3 to i=4), and similarly i=4 has eccentricity 3 too.
i=2 and i=3 have eccentricity 2 as they require at most 2 jumps to reach anywhere.
The smallest eccentricity of any location is 2, which makes 2 the radius of the sequence's digraph, so a(5)=2.
		

Crossrefs

Programs

  • C
    /* See links */

A367129 a(1)=a(2)=1; thereafter a(n) is the diameter of the sequence's digraph, where jumps from location i to i+-a(i) are permitted (within 1..n-1).

Original entry on oeis.org

1, 1, 1, 2, 3, 3, 4, 4, 4, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 24, 24, 24, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22
Offset: 1

Views

Author

Neal Gersh Tolunsky, Nov 05 2023

Keywords

Comments

The diameter of the sequence's digraph is the largest eccentricity of any vertex (location) in the graph. The eccentricity of a location i means the largest number of jumps in the shortest path from location i to any other location.

Examples

			a(5)=3 because i=1 has the largest eccentricity of any location. i=1 takes 3 jumps to reach i=4 in the shortest path:
  i    = 1  2  3  4
  a(i) = 1, 1, 1, 2
         1->1->1->2
Every other location has eccentricity 2, which makes 3 the largest eccentricity and thus the diameter of the sequence's digraph, so a(5)=3.
		

Crossrefs

Programs

  • C
    /* See links */
Showing 1-8 of 8 results.