|
|
A272610
|
|
a(1)=5, a(2)=9, a(3)=4, a(4)=6; thereafter a(n) = a(n-a(n-1)) + a(n-a(n-2)).
|
|
9
|
|
|
5, 9, 4, 6, 5, 5, 18, 4, 5, 10, 10, 18, 4, 10, 15, 10, 27, 4, 15, 15, 10, 36, 4, 15, 20, 15, 36, 4, 20, 25, 15, 45, 4, 25, 25, 20, 45, 4, 25, 35, 15, 54, 4, 35, 25, 20, 72, 4, 25, 40, 25, 54, 4, 40, 40, 20, 72, 4, 40, 35, 25, 81, 4, 35, 50, 25, 81, 4, 50, 40, 25, 117
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
In calculating terms of this sequence, use the convention that a(n)=0 for n<=0.
Similar to Hofstadter's Q-sequence A005185 but with different starting values.
No other term of this sequence changes if a(4) is replaced by a number greater than 6.
If a(2) is replaced by a number N greater than 9, then every other term of the form a(5n+2) is replaced by a(5n+2)*N/9.
|
|
LINKS
|
|
|
FORMULA
|
|
|
MAPLE
|
if n <= 0 then
return 0:
elif n = 1 then
return 5:
elif n = 2 then
return 9:
elif n = 3 then
return 4:
elif n = 4 then
return 6:
else
fi:
end:
|
|
MATHEMATICA
|
a[n_] := a[n] = Switch[n, _?NonPositive, 0, 1, 5, 2, 9, 3, 4, 4, 6, _,
a[n - a[n - 1]] + a[n - a[n - 2]]];
|
|
PROG
|
(Python)
from functools import cache
@cache
def a(n):
if n < 0: return 0
if n < 5: return [0, 5, 9, 4, 6][n]
return a(n - a(n-1)) + a(n - a(n-2))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|