OFFSET
0,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,0,1,-1).
FORMULA
For n>7: a(n) = 8*floor(n/8) + a(n mod 8).
From Elmo R. Oliveira, May 11 2026: (Start)
a(n) = a(n-1) + a(n-8) - a(n-9).
G.f.: x*(4-3*x+4*x^2-3*x^3+4*x^4-3*x^5+4*x^6+x^7) / ((1+x)*(1+x^2)*(1+x^4)*(x-1)^2). (End)
EXAMPLE
a(2)=a('010')='001'=1; a(3)=a('011')='101'=5; a(4)=a('100')='010'=2; a(5)=a('101')='110'=6;
a(20)=a('10'100')='10'010'=18; a(21)=a('10'101')='10'110'=22.
MATHEMATICA
r3bd[n_]:=Module[{a, b}, {a, b}=Reverse[TakeDrop[IntegerDigits[n, 2], -3]]; FromDigits[Join[a, RotateRight[b]], 2]]; Join[{0, 4, 1, 5}, Table[r3bd[n], {n, 4, 80}]] (* Harvey P. Dale, Jul 30 2021 *)
(* Alternative: *)
LinearRecurrence[{1, 0, 0, 0, 0, 0, 0, 1, -1}, {0, 4, 1, 5, 2, 6, 3, 7, 8}, 73] (* Georg Fischer, Jul 03 2025 *)
PROG
(Python)
def A080414(n): return ((n&6)>>1)+((n&1)<<2)+(n&-8) # Chai Wah Wu, Jan 21 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Feb 17 2003
STATUS
approved
