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!)
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. 11
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
LINKS
Rémy Sigrist, PARI program
EXAMPLE
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
PROG
(Python)
def A(lastn, mode=0):
a, n, t=[1], 0, 1
while n<lastn:
d, g, r, rr=[[n]], 0, 0, [n]
while len(d)>0:
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]])<t:g=1
if d[-1][-1]+a[d[-1][-1]]<=n:
if d[-1].count(d[-1][-1]+a[d[-1][-1]])<t:
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(len(rr))
n+=1
print(n+1, a[n])
if mode>0: print(a)
return a # S. Brunner, Feb 26 2023
(PARI) See Links section.
CROSSREFS
Sequence in context: A172006 A172005 A200247 * A056791 A333262 A218767
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, Feb 18 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 21 18:37 EDT 2024. Contains 373556 sequences. (Running on oeis4.)