OFFSET
1,1
COMMENTS
Row 4 of the array in A007062.
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,-2,2,-2,2,-2,2,-2,2,-2,2,-1).
EXAMPLE
Group natural numbers into blocks of 2: [1, 2], [3, 4], [5, 6], [7, 8], ...
Reverse the order in each block: [2, 1], [4, 3], [6, 5], [8, 7], ...
Group the remaining sequence into blocks of 3: [2, 1, 4], [3, 6, 5], ...
Reverse the order in each block: [4, 1, 2], [5, 6, 3], ...
Group the remaining sequence into blocks of 4: [4, 1, 2, 5], [6, 3, 10, 7],
Reverse the order in each block to get a(n): 5, 2, 1, 4, 7, 10, 3, 6, ...
MATHEMATICA
Table[1 + Mod[n + 1, 2] + 2 Floor[3 Floor[((1 + 4 Floor[(n - 1)/4] + Mod[-n, 4]) - 1)/3]/2 + Mod[-(1 + 4 Floor[(n - 1)/4] + Mod[-n, 4]), 3]/2], {n, 100}]
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Oct 14 2023
STATUS
approved