login
2-adic continued fraction of zero, where a(n) = -1 if n is odd, 2*A006519(n/2) otherwise.
6

%I #14 Nov 07 2018 03:54:23

%S -1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,

%T 4,-1,2,-1,32,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,

%U -1,8,-1,2,-1,4,-1,2,-1,64,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,16,-1,2,-1,4,-1,2,-1,8,-1,2,-1,4,-1,2,-1,32,-1,2,-1

%N 2-adic continued fraction of zero, where a(n) = -1 if n is odd, 2*A006519(n/2) otherwise.

%C Limit of convergents equals zero; only the 6th convergent is indeterminate. Other 2-adic continued fractions of zero are: A118821, A118824, A118827. A006519(n) is the highest power of 2 dividing n; A080277 = partial sums of A038712, where A038712(n) = 2*A006519(n) - 1.

%H Antti Karttunen, <a href="/A118830/b118830.txt">Table of n, a(n) for n = 1..65537</a>

%e For n >= 1, convergents A118831(k)/A118832(k):

%e at k = 4*n: 1/(2*A080277(n));

%e at k = 4*n+1: 1/(2*A080277(n)-1);

%e at k = 4*n+2: 1/(2*A080277(n)-2);

%e at k = 4*n-1: 0.

%e Convergents begin:

%e -1/1, -1/2, 0/-1, -1/-2, 1/1, 1/0, 0/1, 1/8,

%e -1/-7, -1/-6, 0/-1, -1/-10, 1/9, 1/8, 0/1, 1/24,

%e -1/-23, -1/-22, 0/-1, -1/-26, 1/25, 1/24, 0/1, 1/32,

%e -1/-31, -1/-30, 0/-1, -1/-34, 1/33, 1/32, 0/1, 1/64, ...

%t Array[If[OddQ@ #, -1, 2^IntegerExponent[#, 2]] &, 99] (* _Michael De Vlieger_, Nov 06 2018 *)

%o (PARI) a(n)=local(p=-1,q=+2);if(n%2==1,p,q*2^valuation(n/2,2))

%Y Cf. A006519, A080277; convergents: A118831/A118832; variants: A118821, A118824, A118827; A100338.

%K cofr,sign

%O 1,2

%A _Paul D. Hanna_, May 01 2006