OFFSET
0,6
MAPLE
f := proc(n) local j; j:=n mod 6; if (j<=1) then 0 elif (j<=4) then 1 else 2; fi; end;
wt := proc(n) local w, m, i; w := 0; m := n; while m > 0 do i := m mod 2; w := w+i; m := (m-i)/2; od; w; end;
A151902 := proc(n) local k, j; k:=floor(n/6); j:=n-6*k; wt(k)+f(j); end;
MATHEMATICA
wt[n_] := DigitCount[n, 2, 1];
f[n_] := {0, 0, 1, 1, 1, 2}[[Mod[n, 6] + 1]];
a[n_] := wt[Floor[n/6]] + f[n - 6 Floor[n/6]];
Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Feb 16 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Jul 31 2009
STATUS
approved