login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A309567
a(1) = 4, a(2) = 2, a(3) = 5, a(4) = 3, a(5) = 1; a(n) = a(n-a(n-1)) + a(n-a(n-4)) for n > 5.
5
4, 2, 5, 3, 1, 4, 7, 5, 8, 6, 4, 12, 5, 13, 6, 9, 17, 5, 18, 6, 9, 22, 5, 23, 11, 9, 27, 5, 28, 11, 9, 32, 5, 33, 11, 14, 37, 5, 38, 11, 14, 42, 5, 43, 11, 14, 47, 5, 48, 16, 14, 52, 5, 53, 16, 14, 57, 5, 58, 16, 14, 62, 5, 63, 16, 19, 67, 5, 68, 16, 19, 72, 5, 73, 16, 19, 77, 5, 78, 16, 19, 82, 5, 83, 21, 19, 87, 5
OFFSET
1,1
COMMENTS
A well-defined quasi-periodic solution for Hofstadter V recurrence (a(n) = a(n-a(n-1)) + a(n-a(n-4))).
LINKS
Altug Alkan, Nathan Fox, Orhan Ozgur Aybar, Zehra Akdeniz, On Some Solutions to Hofstadter's V-Recurrence, arXiv:2002.03396 [math.DS], 2020.
FORMULA
For k >= 1:
a(5*k) = 5*floor(sqrt(k-1))+1,
a(5*k+1) = 5*round(sqrt(k))-1,
a(5*k+2) = 5*k+2,
a(5*k+3) = 5,
a(5*k+4) = 5*k+3.
MAPLE
f:= proc(n) local k, j;
j:= n mod 5;
k:= (n-j)/5;
if j=0 then 5*floor(sqrt(k-1))+1
elif j=1 then 5*round(sqrt(k))-1
elif j=2 then 5*k+2
elif j=3 then 5
else 5*k+3
fi
end proc:
f(1):= 4:
map(f, [$1..100]); # Robert Israel, Aug 08 2019
MATHEMATICA
a[n_] := a[n] = If[n < 6, {4, 2, 5, 3, 1}[[n]], a[n - a[n-1]] + a[n - a[n-4]]]; Array[a, 88] (* Giovanni Resta, Aug 08 2019 *)
PROG
(PARI) q=vector(100); q[1]=4; q[2]=2; q[3]=5; q[4]=3; q[5]=1; for(n=6, #q, q[n]=q[n-q[n-1]]+q[n-q[n-4]]); q
KEYWORD
nonn,easy
AUTHOR
Altug Alkan and Rémy Sigrist, Aug 08 2019
STATUS
approved