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.

A302291 a(n) is the period of the binary expansion of n.

This page as a plain text file.
%I A302291 #12 Apr 19 2020 12:44:09
%S A302291 1,1,2,1,3,3,3,1,4,4,2,4,4,4,4,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,6,6,
%T A302291 6,6,3,6,6,6,6,6,2,6,6,3,6,6,6,6,6,6,6,6,3,6,6,6,6,6,6,6,6,1,7,7,7,7,
%U A302291 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
%N A302291 a(n) is the period of the binary expansion of n.
%C A302291 Zero is assumed to be represented as 0; otherwise, leading zeros are ignored.
%C A302291 See A302295 for the variant where leading zeros are allowed.
%H A302291 Rémy Sigrist, <a href="/A302291/b302291.txt">Table of n, a(n) for n = 0..10000</a>
%H A302291 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A302291 a(n) = A070939(n) / A138904(n).
%F A302291 a(2^n) = n + 1 for any n >= 0.
%F A302291 a(2^n - 1) = 1 for any n >= 0.
%F A302291 a(A020330(n)) = a(n) for any n > 0.
%e A302291 The first terms, alongside the binary expansion of n with periodic part in parentheses, are:
%e A302291   n  a(n)    bin(n)
%e A302291   -- ----    ------
%e A302291    0    1    (0)
%e A302291    1    1    (1)
%e A302291    2    2    (10)
%e A302291    3    1    (1)(1)
%e A302291    4    3    (100)
%e A302291    5    3    (101)
%e A302291    6    3    (110)
%e A302291    7    1    (1)(1)(1)
%e A302291    8    4    (1000)
%e A302291    9    4    (1001)
%e A302291   10    2    (10)(10)
%e A302291   11    4    (1011)
%e A302291   12    4    (1100)
%e A302291   13    4    (1101)
%e A302291   14    4    (1110)
%e A302291   15    1    (1)(1)(1)(1)
%e A302291   16    5    (10000)
%e A302291   17    5    (10001)
%e A302291   18    5    (10010)
%e A302291   19    5    (10011)
%e A302291   20    5    (10100)
%t A302291 Table[If[n==0,1,Length[Union[Array[RotateRight[IntegerDigits[n,2],#]&,IntegerLength[n,2]]]]],{n,0,50}] (* _Gus Wiseman_, Apr 19 2020 *)
%o A302291 (PARI) a(n) = my (l=max(1, #binary(n))); fordiv (l, w, if (#Set(digits(n, 2^w))<=1, return (w)))
%Y A302291 Aperiodic compositions are counted by A000740.
%Y A302291 Aperiodic binary words are counted by A027375.
%Y A302291 The orderless period of prime indices is A052409.
%Y A302291 Numbers whose binary expansion is periodic are A121016.
%Y A302291 Periodic compositions are counted by A178472.
%Y A302291 Numbers whose prime signature is aperiodic are A329139.
%Y A302291 Compositions by number of distinct rotations are A333941.
%Y A302291 All of the following pertain to compositions in standard order (A066099):
%Y A302291 - Length is A000120.
%Y A302291 - Necklaces are A065609.
%Y A302291 - Sum is A070939.
%Y A302291 - Runs are counted by A124767.
%Y A302291 - Rotational symmetries are counted by A138904.
%Y A302291 - Strict compositions are A233564.
%Y A302291 - Constant compositions are A272919.
%Y A302291 - Lyndon compositions are A275692.
%Y A302291 - Co-Lyndon compositions are A326774.
%Y A302291 - Aperiodic compositions are A328594.
%Y A302291 - Rotational period is A333632.
%Y A302291 - Co-necklaces are A333764.
%Y A302291 - Reversed necklaces are A333943.
%Y A302291 Cf. A000031, A001037, A008965, A019536, A020330, A211100, A302295, A328595, A328596, A329312, A329313, A329326.
%K A302291 nonn,base,easy
%O A302291 0,3
%A A302291 _Rémy Sigrist_, Apr 04 2018