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-10 of 10 results.

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

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

Original entry on oeis.org

1, 1, 2, 3, 3, 4, 4, 4, 7, 7, 7, 8, 9, 9, 9, 9, 9, 9, 12, 12, 13, 13, 13, 13, 13, 14, 14, 17, 17, 17, 17, 17, 24, 24, 24, 25, 25, 26, 27, 27, 28, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 33, 33, 33, 34, 34, 37, 37, 37, 38, 38, 48, 48, 48, 48, 48, 49, 50, 51, 52, 53, 53, 53
Offset: 1

Views

Author

Neal Gersh Tolunsky, Feb 18 2023

Keywords

Comments

a(n) is also the smallest number of terms you can reach from any starting term in the sequence so far. This is true because every term leads back to a(1)=1.
Note that each location can visit up to two terms (doesn't have to be a path), although in this case the example sections shows a path.
a(21)=13 is the earliest term whose solution cannot be represented by a single path in which each index is visited once (found by Kevin Ryde).

Examples

			a(13)=9 because we can reach 9 terms starting from a(1) as follows:
1, 1, 2, 3, 3, 4, 4, 4, 7, 7, 7, 8
1->1->2---->3------->4---------->8
1, 1, 2, 3, 3, 4, 4, 4, 7, 7, 7, 8
         3<----------------------8
1, 1, 2, 3, 3, 4, 4, 4, 7, 7, 7, 8
         3------->4---------->7
This is a total of 9 terms:
1, 1, 2, 3, 3, 4, 4, 4, 7, 7, 7, 8
1  1  2  3  3     4  4        7  8
		

Crossrefs

Programs

  • PARI
    \\ See links.
  • 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 19 2023
    

A358838 Minimum number of jumps needed to go from slab 0 to slab n in Jane Street's infinite sidewalk.

Original entry on oeis.org

0, 1, 2, 5, 3, 6, 9, 4, 7, 10, 10, 5, 8, 8, 11, 11, 11, 6, 14, 9, 9, 12, 12, 12, 15, 12, 7, 18, 15, 10, 10, 10, 13, 13, 13, 13, 16, 16, 13, 16, 8, 19, 19, 16, 11, 11, 11, 11, 19, 14, 14, 14, 14, 14, 22, 17, 17, 17, 14, 17, 17, 9, 20, 20, 20, 17, 17, 12, 12, 12
Offset: 0

Views

Author

Frederic Ruget, Dec 02 2022

Keywords

Comments

Slabs on the sidewalk are numbered n = 0, 1, 2,... and each has a label L(n) = 1, 1, 2, 2, 3, 3,...
At a given slab, a jump can be taken forward or backward by L(n) places (but not back before slab 0).
.
For every n >= 0,
let L(n) = 1 + floor(n/2) -- the label on slab n,
let forward(n) = n + L(n) -- jumping forward,
if n > 0, let backward(n) = n - L(n) -- jumping backward,
let lambda(n) = floor((2/3)*n),
let mu(n) = 1 + 2*n,
let nu(n) = 2 + 2*n.
Observe that given n >= 0, there are exactly two ways of landing onto slab n with a direct jump backwards:
backward-jumping from mu(n) to n, and
backward-jumping from nu(n) to n.
If n is a multiple of 3, there is no other ways of jumping onto slab n. But if n is not a multiple of 3, there is one additional way:
forward-jumping from lambda(n) to n.
(Note that L is A008619, forward(n) == A006999(n+1), lambda is A004523, mu is A005408, nu is A299174.)
.
Every slab n > 0 is reachable from slab 0, since there always exists some slab s < n which reaches n by one or more jumps:
if n != 0 (mod 3), then s = lambda(n) = floor((2/3)*n) takes one forward jump to n,
if n == 0 (mod 3) but n != 0 (mod 9), then s = lambda o lambda o mu(n) = floor((8/9)*n) takes two forward jumps and one backward jump to n,
if n == 0 (mod 9), then s = lambda o lambda o nu(n) = floor((8/9)*n + 6/9) takes two forward jumps and one backward jump to n.
This demonstrates that the sequence never stops.
This also gives the following bounds:
a(n) <= 1 + (4/3)*n,
a(n) <= 6*log(n)/log(9/8).
.
The sequence is a surjective mapping N -> N, since given any n >= 0:
a(forward^n(0)) == n.

Examples

			For n=0, a(0) = 0 since it takes zero jump to go from slab 0 to slab 0.
For n=3, a(3) = 5 jumps is the minimum needed to go from slab 0 to slab 3:
.
        1st   2nd      3rd           4th
        jump  jump     jump          jump
        ->-   ->-   ---->----   ------->-------
       /   \ /   \ /         \ /               \
n     0     1     2     3     4     5     6     7     8  ...
L(n)  1     1     2     2     3     3     4     4     5  ...
                         \                     /
                          ----------<----------
                                 5th jump (backwards)
		

Crossrefs

Always jumping forwards yields A006999.
In the COMMENTS section, L is A008619, forward(n) == A006999(n+1), lambda is A004523, mu is A005408, nu is A299174.
For related sequences, see A360744-A360746 and A360593-A360595.

Programs

  • Python
    def a(n: int) -> int:
        import itertools
        if n < 0: raise Exception("n must be a nonnegative integer")
        if n == 0: return 0
        if n == 1: return 1
        visited = {0, 1}  # the slabs we have visited so far
        rings = [{0}, {1}]  # the slabs ordered by depth (min length of path from 0)
        for depth in itertools.count(2):
            new_ring = set()
            for slab in rings[depth - 1]:
                label = (slab >> 1) + 1
                for next_slab in {slab - label, slab + label}:
                    if not next_slab in visited:
                        if next_slab == n: return depth
                        visited.add(next_slab)
                        new_ring.add(next_slab)
            rings.append(new_ring)

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 */

A365159 a(n)=n for n<=3, and thereafter, a(n) is the number of locations 1..n-1 which cannot be reached starting from i=n-1, where jumps from location i to i +- a(i) are permitted (within 1..n-1). See example.

Original entry on oeis.org

1, 2, 3, 2, 2, 3, 4, 4, 3, 6, 4, 6, 8, 5, 9, 10, 11, 12, 13, 13, 11, 11, 13, 13, 15, 15, 16, 17, 18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 26, 18, 26, 29, 20, 23, 24, 25, 26, 27, 28, 29, 29, 28, 31, 29, 28, 29, 30, 31, 32, 33, 34, 34, 38, 27, 39, 40, 41, 42, 42
Offset: 1

Views

Author

Neal Gersh Tolunsky, Aug 23 2023

Keywords

Examples

			a(9)=3 because there are 3 locations that cannot be reached starting from i=n-1=8, where a(8)=4. We start by finding the locations that can be reached (each line shows the next unvisited location(s) we can reach from the term(s) in the previous iteration):
1, 2, 3, 2, 2, 3, 4, 4
         2<----------4
1, 2, 3, 2, 2, 3, 4, 4
   2<----2---->3
1, 2, 3, 2, 2, 3, 4, 4
      3<-------3
We visited 5 locations (i = 2, 3, 4, 6, and 8) and can visit no more:
1, 2, 3, 2, 2, 3, 4, 4
   2  3  2     3     4
This leaves a total of 3 locations that could not be reached (i = 1, 5, and 7) from i=8, so a(9)=3.
		

Crossrefs

Cf. A360746.
Showing 1-10 of 10 results.