|
|
|
|
0, 0, 1, 1, 0, 2, 2, 1, 3, 3, 1, 4, 0, 0, 5, 5, 2, 2, 5, 2, 6, 6, 1, 7, 0, 3, 8, 1, 3, 9, 9, 1, 3, 9, 4, 10, 10, 0, 3, 10, 0, 11, 2, 5, 12, 1, 5, 4, 12, 2, 13, 13, 2, 14, 14, 5, 15, 3, 2, 4, 0, 6, 1, 15, 6, 16, 2, 1, 17, 17, 7, 4, 4, 0, 18, 18, 3, 6, 18, 8, 5, 18, 1, 19, 0, 3, 20, 1, 9, 21, 21, 9, 6, 1, 1, 22, 22, 3, 23, 23, 9, 4, 5, 4, 5
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,6
|
|
COMMENTS
|
Locate the node which contains n in binary tree A245612 (or in its mirror-image A244154) and traverse from that node towards the root, counting all multiples of three that occur on the path. More formally, for n > 1, a(n) counts the multiples of 3 encountered until 1 is reached, when we iterate the map x -> A285712(x), starting from x=n. The count includes also n itself if it is a multiple of 3.
|
|
LINKS
|
|
|
FORMULA
|
|
|
MATHEMATICA
|
f[n_] := f[n] = Which[n == 1, 0, Mod[n, 3] == 2, Ceiling[n/3], True, (Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[2 n - 1] + 1)/2]; a[n_] := a[n] = If[n == 1, n - 1, 2 a[f@ n] + Boole[Divisible[n, 3]]]; Array[DigitCount[a@ #, 2, 1] &, 105] (* Michael De Vlieger, Sep 22 2017 *)
|
|
PROG
|
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|