A228367 n-th element of the ruler function plus the highest power of 2 dividing n.
2, 4, 2, 7, 2, 4, 2, 12, 2, 4, 2, 7, 2, 4, 2, 21, 2, 4, 2, 7, 2, 4, 2, 12, 2, 4, 2, 7, 2, 4, 2, 38, 2, 4, 2, 7, 2, 4, 2, 12, 2, 4, 2, 7, 2, 4, 2, 21, 2, 4, 2, 7, 2, 4, 2, 12, 2, 4, 2, 7, 2, 4, 2, 71, 2, 4, 2, 7, 2, 4, 2, 12, 2, 4, 2, 7, 2, 4, 2, 21, 2, 4, 2, 7
Offset: 1
Examples
Illustration of initial terms (n = 1..16) using a diagram of compositions in which A001511(n) is the length of the horizontal line segment in row n and A006519(n) is the length of the vertical line segment ending in row n. Hence a(n) is the length of the n-th pair of orthogonal line segments. Also counting both the x-axis and the y-axis we have that A001511(n) is also the largest part of the n-th region of the diagram and A006519(n) is also the number of parts of the n-th region of the diagram, see below. --------------------------------------------------------- . Diagram of n A001511(n) compositions A006519(n) a(n) --------------------------------------------------------- 1 1 _| | | | | 1 2 2 2 _ _| | | | 2 4 3 1 _| | | | 1 2 4 3 _ _ _| | | 4 7 5 1 _| | | | 1 2 6 2 _ _| | | 2 4 7 1 _| | | 1 2 8 4 _ _ _ _| | 8 12 9 1 _| | | | 1 2 10 2 _ _| | | 2 4 11 1 _| | | 1 2 12 3 _ _ _| | 4 7 13 1 _| | | 1 2 14 2 _ _| | 2 4 15 1 _| | 1 2 16 5 _ _ _ _ _| 16 21 ... If written as an irregular triangle the sequence begins: 2; 4; 2, 7; 2, 4, 2, 12; 2, 4, 2, 7, 2, 4, 2, 21; 2, 4, 2, 7, 2, 4, 2, 12, 2, 4, 2, 7, 2, 4, 2, 38; ... Row lengths is A011782. Right border gives A005126. Counting both the x-axis and the y-axis we have that A038712(n) is the area (or the number of cells) of the n-th region of the diagram. Note that adding only the x-axis to the diagram we have a tree. - _Omar E. Pol_, Nov 07 2018
Links
Crossrefs
Programs
-
Mathematica
Array[1 + # + 2^# &[IntegerExponent[#, 2]] &, 84] (* Michael De Vlieger, Nov 06 2018 *)
-
PARI
A228367(n) = (1 + valuation(n,2) + 2^valuation(n,2)); \\ Antti Karttunen, Nov 06 2018
-
Python
def A228367(n): return (m:=n&-n)+m.bit_length() # Chai Wah Wu, Jul 14 2022
Comments