login
2-adic valuation of the n-th Motzkin number.
2

%I #38 Aug 26 2024 09:53:55

%S 0,0,1,2,0,0,0,0,0,0,2,1,0,0,1,2,0,0,1,2,0,0,0,0,0,0,2,1,0,0,0,0,0,0,

%T 1,2,0,0,0,0,0,0,2,1,0,0,2,1,0,0,1,2,0,0,0,0,0,0,2,1,0,0,1,2,0,0,1,2,

%U 0,0,0,0,0,0,2,1,0,0,1,2,0,0,1,2,0,0,0,0,0,0,2,1,0,0,0,0,0,0,1,2,0,0,0,0,0

%N 2-adic valuation of the n-th Motzkin number.

%H Antti Karttunen, <a href="/A186034/b186034.txt">Table of n, a(n) for n = 0..4095</a>

%H Eric Rowland and Reem Yassawi, <a href="https://doi.org/10.5802/jtnb.901">Automatic congruences for diagonals of rational functions</a>, Journal de théorie des nombres de Bordeaux, Vol. 27, No. 1 (2015), pp. 245-288; <a href="https://arxiv.org/abs/1310.8635">arXiv preprint</a>, arXiv:1310.8635 [math.NT], 2013-2014.

%F a(n) = log_2(A001006(n)/numerator(A001006(n)/2^n)).

%F (-1)^a(n) = A186035(n).

%F a(n) = A007814(A001006(n)). - _Antti Karttunen_, Aug 12 2017

%F From _Amiram Eldar_, Aug 26 2024: (Start)

%F Results from Rowland and Yassawi (2015):

%F 0 <= a(n) <= 2.

%F Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = Sum_{k=0..2} d(k) * k = 1/2, where d(k) is the asymptotic density of the occurrences of k in this sequence: d(0) = 2/3, and d(1) = d(2) = 1/6. (End)

%p A186034 := proc(n)

%p local m,ml ;

%p m := A001006(n) ;

%p ml := %/2^n ;

%p m/numer(ml) ;

%p ilog2(%) ;

%p end proc:

%p seq(A186034(n),n=0..80) ; # _R. J. Mathar_, Feb 13 2015

%t IntegerExponent[RecurrenceTable[(n + 4) M[n + 2] - (2 n + 5) M[n + 1] - 3 (n + 1) M[n] == 0 && M[0] == M[1] == 1, M[n], {n, 0, 127}], 2] (* _Eric Rowland_, May 06 2013 *)

%o (Python)

%o from itertools import count, islice

%o def A186034_gen(): # generator of terms

%o a, b = 1, 1

%o yield from (0, 0)

%o for n in count(2):

%o a, b = b, (b*(2*n+1)+a*3*(n-1))//(n+2)

%o yield (~b&b-1).bit_length()

%o A186034_list = list(islice(A186034_gen(),30)) # _Chai Wah Wu_, Jul 08 2022

%Y Cf. A001006, A007814, A186035.

%K nonn

%O 0,4

%A _Paul Barry_, Feb 11 2011

%E Definition edited by _Eric Rowland_, May 06 2013

%E More terms from _Antti Karttunen_, Aug 12 2017