%I #40 Jul 16 2022 01:04:36
%S 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,
%T 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,
%U 2,4,2,7,2,4,2,12,2,4,2,7,2,4,2,21,2,4,2,7
%N n-th element of the ruler function plus the highest power of 2 dividing n.
%C a(n) is also the length of the n-th pair of orthogonal line segments in a diagram of compositions, see example.
%C a(n) is also the largest part plus the number of parts of the n-th region of the mentioned diagram (if the axes both "x" and "y" are included in the diagram).
%C a(n) is also the number of toothpicks added at n-th stage to the structure of A228366. Essentially the first differences of A228366.
%C The equivalent sequence for partitions is A207779.
%H Antti Karttunen, <a href="/A228367/b228367.txt">Table of n, a(n) for n = 1..16383</a>
%H N. J. A. Sloane, <a href="/wiki/Catalog_of_Toothpick_and_CA_Sequences_in_OEIS">Catalog of Toothpick and Cellular Automata Sequences in the OEIS</a>
%H <a href="/index/To#toothpick">Index entries for sequences related to toothpick sequences</a>
%F a(n) = A001511(n) + A006519(n).
%e 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.
%e ---------------------------------------------------------
%e . Diagram of
%e n A001511(n) compositions A006519(n) a(n)
%e ---------------------------------------------------------
%e 1 1 _| | | | | 1 2
%e 2 2 _ _| | | | 2 4
%e 3 1 _| | | | 1 2
%e 4 3 _ _ _| | | 4 7
%e 5 1 _| | | | 1 2
%e 6 2 _ _| | | 2 4
%e 7 1 _| | | 1 2
%e 8 4 _ _ _ _| | 8 12
%e 9 1 _| | | | 1 2
%e 10 2 _ _| | | 2 4
%e 11 1 _| | | 1 2
%e 12 3 _ _ _| | 4 7
%e 13 1 _| | | 1 2
%e 14 2 _ _| | 2 4
%e 15 1 _| | 1 2
%e 16 5 _ _ _ _ _| 16 21
%e ...
%e If written as an irregular triangle the sequence begins:
%e 2;
%e 4;
%e 2, 7;
%e 2, 4, 2, 12;
%e 2, 4, 2, 7, 2, 4, 2, 21;
%e 2, 4, 2, 7, 2, 4, 2, 12, 2, 4, 2, 7, 2, 4, 2, 38;
%e ...
%e Row lengths is A011782. Right border gives A005126.
%e 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
%t Array[1 + # + 2^# &[IntegerExponent[#, 2]] &, 84] (* _Michael De Vlieger_, Nov 06 2018 *)
%o (PARI) A228367(n) = (1 + valuation(n,2) + 2^valuation(n,2)); \\ _Antti Karttunen_, Nov 06 2018
%o (Python)
%o def A228367(n): return (m:=n&-n)+m.bit_length() # _Chai Wah Wu_, Jul 14 2022
%Y Cf. A001511, A001792, A005126, A006519, A011782, A038712, A139250, A139251, A207779, A228366.
%K nonn,tabf
%O 1,1
%A _Omar E. Pol_, Aug 22 2013
|