login
A151902
a(n) = wt(k) + f(j) if n = 6k+j, 0 <= j < 6, where wt() = A000120(), f() = A151899().
5
0, 0, 1, 1, 1, 2, 1, 1, 2, 2, 2, 3, 1, 1, 2, 2, 2, 3, 2, 2, 3, 3, 3, 4, 1, 1, 2, 2, 2, 3, 2, 2, 3, 3, 3, 4, 2, 2, 3, 3, 3, 4, 3, 3, 4, 4, 4, 5, 1, 1, 2, 2, 2, 3, 2, 2, 3, 3, 3, 4, 2, 2, 3, 3, 3, 4, 3, 3, 4, 4, 4, 5, 2, 2, 3, 3, 3, 4, 3, 3, 4, 4, 4, 5, 3, 3, 4, 4, 4, 5, 4, 4, 5, 5, 5, 6, 1, 1, 2, 2, 2, 3, 2, 2, 3
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