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
Michael De Vlieger, Table of n, a(n) for n = 1..10006
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) = 10,
a(5*k+1) = 5*k-2,
a(5*k+2) = 5*(floor((sqrt(2*k-1)-1)/2) + floor((sqrt(2*k-3)-1)/2)) + 6,
a(5*k+3) = 5*(floor(sqrt(k/2)) + floor(sqrt((k-1)/2))) + 4,
a(5*k+4) = 5*k-3.
Also, a(5*k+2) = 5*f(k)+1 and a(5*k+3) = 5*g(k)-1 where f(k) = g(k-g(k-1)) and g(k) = f(k-f(k))+2 with f(1) = g(1) = 1, g(2) = 2.
MATHEMATICA
Nest[Append[#, #[[-#[[-1]] ]] + #[[-#[[-4]] ]]] &, {3, 1, 4, 2, 5, 3}, 69] (* Michael De Vlieger, May 08 2020 *)
PROG
(PARI) q=vector(100); q[1]=3; q[2]=1; q[3]=4; q[4]=2; q[5]=5; q[6]=3; for(n=7, #q, q[n] = q[n-q[n-1]] + q[n-q[n-4]]); q
(Magma) I:=[3, 1, 4, 2, 5, 3]; [n le 6 select I[n] else Self(n-Self(n-1)) + Self(n-Self(n-4)): n in [1..80]]; // Marius A. Burtea, Aug 11 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Altug Alkan and Nathan Fox, Aug 10 2019
STATUS
approved