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.

A300655 a(n) is the length of the longest contiguous block of ones in the binary expansion of 1/n.

This page as a plain text file.
%I A300655 #7 Mar 11 2018 17:17:31
%S A300655 1,1,1,1,2,1,1,1,3,2,3,1,3,1,1,1,4,3,4,2,2,3,2,1,4,3,4,1,4,1,1,1,5,4,
%T A300655 3,3,5,4,2,2,5,2,5,3,2,2,3,1,4,4,1,3,5,4,4,1,5,4,5,1,5,1,1,1,6,5,6,4,
%U A300655 3,3,3,3,3,5,3,4,4,2,4,2,6,5,6,2,2,5,4
%N A300655 a(n) is the length of the longest contiguous block of ones in the binary expansion of 1/n.
%C A300655 This sequence has similarities with A038374: here we consider the binary expansion of 1/n, there the binary expansion of n.
%F A300655 a(2*n) = a(n).
%F A300655 a(2^k + 1) = k for any k > 0.
%F A300655 a(n) = 1 iff n belongs to A300630.
%e A300655 The first terms, alongside the binary representation of 1/n, are:
%e A300655   n   a(n)  bin(1/n) with repeating digits in parentheses
%e A300655   --  ----  ---------------------------------------------
%e A300655    1     1  1.(0)
%e A300655    2     1  0.1(0)
%e A300655    3     1  0.(01)
%e A300655    4     1  0.01(0)
%e A300655    5     2  0.(0011)
%e A300655    6     1  0.0(01)
%e A300655    7     1  0.(001)
%e A300655    8     1  0.001(0)
%e A300655    9     3  0.(000111)
%e A300655   10     2  0.0(0011)
%e A300655   11     3  0.(0001011101)
%e A300655   12     1  0.00(01)
%e A300655   13     3  0.(000100111011)
%e A300655   14     1  0.0(001)
%e A300655   15     1  0.(0001)
%e A300655   16     1  0.0001(0)
%e A300655   17     4  0.(00001111)
%e A300655   18     3  0.0(000111)
%e A300655   19     4  0.(000011010111100101)
%e A300655   20     2  0.00(0011)
%o A300655 (PARI) a(n) = my (w=1, s=Set(), f=1/max(n,2)); while (!setsearch(s,f), while (floor(f*2^(w+1))==2^(w+1)-1, w++); s=setunion(s,Set(f)); f=frac(f*2)); return (w)
%Y A300655 Cf. A038374, A300630.
%K A300655 nonn,base
%O A300655 1,5
%A A300655 _Rémy Sigrist_, Mar 10 2018