OFFSET
0,3
COMMENTS
This is a permutations of the nonnegative integers.
Some of the cycles of this permutation are: (0),(1),(2),(3),(5 4),(7 6),(10 12 15 13 11 9 8),(17 14),(20 25 21 18 22 27 23 19 16),... .
LINKS
FORMULA
a(4*m) = 5*m.
a(2+4*m) = 2+5*m.
a(1+6*m) = 1+5*m.
a(3+6*m) = 3+5*m.
a(4+6*m) = 4+5*m.
a(n) = -2*a(n-1) - 3*a(n-2) - 4*a(n-3) - 4*a(n-4) - 4*a(n-5) - 3*a(n-6) - 2*a(n-7) - a(n-8) + 25n - 101 for n >= 8.
G.f.: x*(1 + 2*x + 3*x^2 + 5*x^3 + 3*x^4 + 5*x^5 + 2*x^6 + 3*x^7 + x^8)/(1 - x^4 - x^6 + x^10). - Stefano Spezia, Mar 01 2021
PROG
(MATLAB)
function a = A340709(max_n)
for n = 1:max_n*10
k = (n-1)+floor(((n-1)+1)/5);
m = n-1;
if floor(k/2) == k/2
A340615(n) = k/2;
else
A340615(n) = (k*3+1)/2;
end
if floor(m/2) == m/2
b(n) = m/2+floor(m/4);
else
b(n) = (m*3+1)/2;
end
end
for n = 1:(length(A340615)/10)
a(n) = find(A340615==b(n))-1;
end
end
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Thomas Scheuerle, Jan 16 2021
STATUS
approved