login
A256143
Fibonacci Mutant Bunnies. Start at 1,1,1 and, at each step, either add the last three elements or take the difference of the last two. a(n) is equal to the minimum number of steps to get to n.
1
1, 0, 2, 1, 4, 2, 3, 6, 5, 3, 4, 4, 5, 7, 6, 6, 6, 4, 5, 5, 6, 8, 6, 7, 7, 8, 7, 7, 7, 6, 8, 5, 8, 7, 6, 8, 6, 8, 7, 10, 8, 10, 9, 9, 8, 9, 9, 10, 8, 9, 8, 8, 9, 7, 9, 9, 7, 6, 8, 7, 9, 8, 7, 11, 9, 8, 7, 9, 8, 10, 10, 11, 8, 10, 10, 9, 9, 10, 10, 11, 10, 10
OFFSET
0,3
COMMENTS
It is possible to get to any positive integer.
A sequence worthy of consideration when teaching students subtraction.
For students, it is easier to ask them how many elements are needed in the sequence before they can get to n. This just adds three to all terms in the sequence except a(1):
4, 1, 5, 4, 7, 5, 6, 9, 8, 6, 7, 7, 8, 10, 9, 9, 9, 7, 8, 8, 9.
In this sequence, "difference of the last two" means absolute difference. - Michael S. Branicky, Apr 04 2021
LINKS
Gordon Hamilton, Fibonacci Killer Bunny Sequence (2012)
EXAMPLE
a(13) = 7 because starting at 1, 1, 1 it takes 7 steps to get to 13:
1, 1, 1, 3, 5, 9, 4, 5, 18, 13.
Here is a different way:
1, 1, 1, 0, 1, 1, 2, 4, 7, 13.
PROG
(Python)
def aupto(limit):
start, goals = (1, 1, 1), set(range(limit+1)) - {1}
steps, paths = {b: 0 for b in start}, {(0, ) + start}
iters = 1
while len(goals) > 0:
newpaths = []
while len(paths) > 0:
p = paths.pop() # each p stores last 3 elements
sum3, diff2 = sum(p[-3:]), abs(p[-2]-p[-1])
for newb in [sum3, diff2]:
if newb in goals:
steps[newb] = iters
goals.discard(newb)
newpaths.append( p[1:] + (newb, ) )
paths = newpaths
iters += 1
return [steps[b] for b in range(limit+1)]
print(aupto(81)) # Michael S. Branicky, Apr 04 2021
CROSSREFS
Sequence in context: A036998 A121464 A090278 * A352791 A274455 A153279
KEYWORD
nonn
AUTHOR
Gordon Hamilton, Mar 16 2015
EXTENSIONS
a(21)-a(81) from Hiroaki Yamanouchi, Mar 25 2015
STATUS
approved