The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 5
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
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.
LINKS
EXAMPLE
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.
PROG
(Python)
def A(lastn, times=3, mode=0):
a, n=[0], 0
while n<lastn:
d, i, v, o, g, r=[[n]], 0, 1, [], 0, 0
while len(d)>0:
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]])<times:g=1
if d[-1][-1]+a[d[-1][-1]]<=n:
if d[-1].count(d[-1][-1]+a[d[-1][-1]])<times:
if g>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<len(o):
q.append(a[o[u]])
u+=1
print(n+1, a[n], q, o)
return a
CROSSREFS
Cf. A360593.
Sequence in context: A201282 A234522 A057056 * A016469 A274342 A138746
KEYWORD
nonn
AUTHOR
S. Brunner, Feb 14 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 4 22:04 EDT 2024. Contains 373102 sequences. (Running on oeis4.)