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
Robert Israel, Table of n, a(n) for n = 1..10000
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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Altug Alkan and Rémy Sigrist, Aug 08 2019
STATUS
approved