cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A300654 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).

Original entry on oeis.org

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, 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, 2, 2, 4, 4, 64, 4, 14, 8, 14, 4, 4, 32, 11, 16, 17, 6, 22, 4
Offset: 1

Views

Author

Rémy Sigrist, Mar 10 2018

Keywords

Comments

Equivalently, a(n) is the greatest k such that A300653(n, k) = k.
This sequence has similarities with A144016: here we consider the binary expansion of 1/n, there the binary expansion of n.

Examples

			For n = 19:
- the binary expansion of 1/19 is 0.0000(110101111001010000) (with repeating digits in parentheses),
- the first occurrence of the binary representation of k for k = 1..16 is:
  k   bin(k)  bin(1/19) with bin(k) in parentheses
  --  ------  ------------------------------------
   1      1   0.0000(1)101...
   2     10   0.00001(10)101...
   3     11   0.0000(11)010...
   4    100   0.000011010111(100)101...
   5    101   0.00001(101)011...
   6    110   0.0000(110)101...
   7    111   0.000011010(111)100...
   8   1000   0.00001101011110010(1000)011...
   9   1001   0.000011010111(1001)010...
  10   1010   0.00001(1010)111...
  11   1011   0.0000110(1011)110...
  12   1100   0.00001101011(1100)101...
  13   1101   0.0000(1101)011...
  14   1110   0.0000110101(1110)010...
  15   1111   0.000011010(1111)001...
  16  10000   0.00001101011110010(10000)110...
- the binary representation of 17 (10001) is missing,
- hence a(19) = 16.
		

Crossrefs

Programs

  • PARI
    See Links section.

Formula

a(2*n) = a(n).
a(n) = 2 iff n belongs to A300630.