login
For any nonnegative real number x, let f(x) be the real number obtained by replacing in the binary expansions of the integer and fractional parts of x each finite run of k consecutive equal bits b with a run of k-(-1)^k consecutive bits b; a(n) is the numerator of f(1/n).
2

%I #15 Feb 27 2020 23:21:28

%S 3,3,1,3,1,2,3,3,1,1,13,1,7,3,1,3,1,2,77,1,1,26,203,1,817,14,109,3,

%T 1037,2,3,3,1,1,1297,1,20275,77,155,1,17,1,13,13,67,203,6716227,1,

%U 421735,817,17,7,2306997,109,55739,3,49,1037,818712813,1,138203853,3

%N For any nonnegative real number x, let f(x) be the real number obtained by replacing in the binary expansions of the integer and fractional parts of x each finite run of k consecutive equal bits b with a run of k-(-1)^k consecutive bits b; a(n) is the numerator of f(1/n).

%C When computing f(x), we consider the unique binary representation of x where the fractional part of x does not eventually end with repeating ones.

%C The function f establishes a self-inverse bijection:

%C - over the nonnegative real numbers,

%C - over the nonnegative real numbers in the half-open interval [0,1),

%C - over the nonnegative rational numbers,

%C - over the nonnegative rational numbers in the half-open interval [0,1),

%C - over the nonnegative integers (for any n >= 0, f(n) = A162853(n)).

%C The function f has only one fixed point: f(0) = 0.

%H Rémy Sigrist, <a href="/A323626/a323626.png">Representation of f in the half-open interval [0,1)</a>

%H Rémy Sigrist, <a href="/A323626/a323626_1.gp.txt">PARI program for A323626</a>

%F a(2^k) = 3 for any k >= 0.

%F a(2^k-1) = 2-(-1)^k for any k > 0.

%e The first terms of the sequence, alongside f(1/n) and the binary representations of 1/n and of f(1/n) with periodic part in parentheses, are:

%e n a(n) f(1/n) bin(1/n) bin(f(1/n))

%e -- ---- ------- ---------------------- ------------------------

%e 1 3 3 1.(0) 11.(0)

%e 2 3 3/4 0.1(0) 0.11(0)

%e 3 1 1/5 0.(01) 0.(0011)

%e 4 3 3/16 0.01(0) 0.0011(0)

%e 5 1 1/3 0.(0011) 0.(01)

%e 6 2 2/5 0.0(01) 0.(0110)

%e 7 3 3/7 0.(001) 0.(011)

%e 8 3 3/8 0.001(0) 0.011(0)

%e 9 1 1/17 0.(000111) 0.(00001111)

%e 10 1 1/24 0.0(0011) 0.000(01)

%e 11 13 13/257 0.(0001011101) 0.(0000110011110011)

%e 12 1 1/20 0.00(01) 0.00(0011)

%e 13 7 7/129 0.(000100111011) 0.(00001101111001)

%e 14 3 3/56 0.0(001) 0.000(011)

%e 15 1 1/21 0.(0001) 0.(000011)

%e 16 3 3/64 0.0001(0) 0.000011(0)

%e 17 1 1/9 0.(00001111) 0.(000111)

%e 18 2 2/17 0.0(000111) 0.(00011110)

%e 19 77 77/1025 0.(000011010111100101) 0.(00010011001110110011)

%e 20 1 1/12 0.00(0011) 0.00(01)

%o (PARI) See Links section.

%Y See A323627 for the corresponding denominators.

%Y Cf. A162853.

%K nonn,frac,base

%O 1,1

%A _Rémy Sigrist_, Jan 20 2019