



0, 0, 0, 1, 0, 0, 2, 2, 0, 1, 0, 0, 4, 5, 4, 5, 0, 0, 2, 2, 0, 1, 0, 0, 8, 8, 10, 11, 8, 8, 10, 10, 0, 1, 0, 0, 4, 5, 4, 5, 0, 0, 2, 2, 0, 1, 0, 0, 16, 17, 16, 17, 20, 20, 22, 23, 16, 17, 16, 16, 20, 21, 20, 21, 0, 0, 2, 2, 0, 1, 0, 0, 8, 8, 10, 11, 8, 8, 10, 10, 0, 1, 0, 0, 4, 5, 4, 5, 0, 0, 2, 2, 0, 1, 0, 0, 32, 32, 34, 35, 32, 32, 34, 34, 40, 41, 40, 41
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,7


COMMENTS

Because A292590(n) = a(A245611(n)), the sequence works as a "masking function" where the 1bits in a(n) (always a subset of the 1bits in binary expansion of n) indicate which numbers are multiples of 3 in binary tree A245612 on that trajectory which leads from the root of the tree to the node containing A245612(n). See the examples.


LINKS

Antti Karttunen, Table of n, a(n) for n = 0..8191
Index entries for sequences related to binary expansion of n
Index entries for sequences computed from indices in prime factorization


FORMULA

a(n) + A292593(n) = n, a(n) AND A292593(n) = 0.
a(n) AND n = a(n), where AND is bitwiseAND (A004198).


EXAMPLE

A245612(18) = 188, that is, at "node address" 18 in binary tree A245612 sits number 188. 18 in binary is "10010", which when read from left to right (after the most significant bit which is always 1) gives the directions to follow in the tree when starting from the root, to land in node containing number 188. Here, after 1 and 2, turn left from 2, turn left from 5, turn right from 14 and then turn left from 63 and then indeed one lands in 188. These turns correspond with the four lowermost bits of the code, "0010". When one selects multiples of 3 from this path 1 > 2 > 5 > 14 > 63 > 188, the only one is 63, which corresponds with the second rightmost bit (which also is the only 1bit) in the code, which can be masked with 2 (binary "10"), thus a(18) = 2.
A245612(15) = 6, that is, at "node address" 15 in binary tree A245612 sits number 6. 15 in binary is "1111", which tells that 6 can be located in tree A245612 by going (after the initial root 1 and 2) three steps towards right from 2: 1 > 2 > 3 > 4 > 6. Of these numbers, only 3 and 6 are multiples of 3, thus the mask to obtain the corresponding bits from "1111" is "00101" (5 in binary), thus a(15) = 5.
A245612(31) = 7, that is, at "node address" 31 in binary tree A245612 sits number 7. 31 in binary is "11111", which tells that 7 can be located in tree A245612 by going (after the initial root 1 and 2) four steps towards right from 2: 1 > 2 > 3 > 4 > 6 > 7. Of these numbers, only 3 and 6 are multiples of 3, thus the mask to obtain the corresponding bits from "11111" is "001010" (ten in binary), thus a(31) = 10.


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]; g[n_] := g[n] = If[n == 1, 0, 2 g[f@ n] + Boole[Divisible[n, 3]]]; h[n_] := (Times @@ Power[If[# == 1, 1, NextPrime@ #] & /@ First@ #, Last@ #] + 1)/2 &@ Transpose@ FactorInteger@If[n == 0, 1, Prime[#] Product[ Prime[m]^(Map[ Ceiling[(Length@ #  1)/2] &, DeleteCases[ Split@ Join[ Riffle[ IntegerDigits[n, 2], 0], {0}], {k__} /; k == 1]][[m]]), {m, #}] &[DigitCount[n, 2, 1]]]; Array[g@ h@ # &, 108, 0] (* Michael De Vlieger, Sep 22 2017 *)


CROSSREFS

Cf. A004198, A292590, A292593.
Cf. also A292377.
Differs from related A292274 for the first time at n=31, where a(31) = 10, while A292274(31) = 11. Compare also the scatter plots.
Sequence in context: A333624 A306595 A332996 * A292274 A317675 A332902
Adjacent sequences: A292589 A292590 A292591 * A292593 A292594 A292595


KEYWORD

nonn,base


AUTHOR

Antti Karttunen, Sep 20 2017


STATUS

approved



