login
a(n) is the greatest k such that, for i = 1..k, the binary representation of i appears as a substring in the binary representation of 1/n (ignoring the radix point and adding trailing zeros if necessary in case of a terminating expansion).
2

%I #8 Mar 11 2018 17:17:38

%S 2,2,2,2,4,2,2,2,4,4,8,2,9,2,2,2,4,4,16,4,4,8,6,2,8,9,11,2,20,2,2,2,4,

%T 4,8,4,32,16,6,4,4,4,8,8,6,6,12,2,12,8,2,9,33,11,10,2,8,20,37,2,41,2,

%U 2,2,4,4,64,4,14,8,14,4,4,32,11,16,17,6,22,4

%N a(n) is the greatest k such that, for i = 1..k, the binary representation of i appears as a substring in the binary representation of 1/n (ignoring the radix point and adding trailing zeros if necessary in case of a terminating expansion).

%C Equivalently, a(n) is the greatest k such that A300653(n, k) = k.

%C This sequence has similarities with A144016: here we consider the binary expansion of 1/n, there the binary expansion of n.

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

%F a(2*n) = a(n).

%F a(n) = 2 iff n belongs to A300630.

%e For n = 19:

%e - the binary expansion of 1/19 is 0.0000(110101111001010000) (with repeating digits in parentheses),

%e - the first occurrence of the binary representation of k for k = 1..16 is:

%e k bin(k) bin(1/19) with bin(k) in parentheses

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

%e 1 1 0.0000(1)101...

%e 2 10 0.00001(10)101...

%e 3 11 0.0000(11)010...

%e 4 100 0.000011010111(100)101...

%e 5 101 0.00001(101)011...

%e 6 110 0.0000(110)101...

%e 7 111 0.000011010(111)100...

%e 8 1000 0.00001101011110010(1000)011...

%e 9 1001 0.000011010111(1001)010...

%e 10 1010 0.00001(1010)111...

%e 11 1011 0.0000110(1011)110...

%e 12 1100 0.00001101011(1100)101...

%e 13 1101 0.0000(1101)011...

%e 14 1110 0.0000110101(1110)010...

%e 15 1111 0.000011010(1111)001...

%e 16 10000 0.00001101011110010(10000)110...

%e - the binary representation of 17 (10001) is missing,

%e - hence a(19) = 16.

%o (PARI) See Links section.

%Y Cf. A144016, A300653, A300630.

%K nonn,base

%O 1,1

%A _Rémy Sigrist_, Mar 10 2018