login
A302291
a(n) is the period of the binary expansion of n.
9
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, 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, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
OFFSET
0,3
COMMENTS
Zero is assumed to be represented as 0; otherwise, leading zeros are ignored.
See A302295 for the variant where leading zeros are allowed.
FORMULA
a(n) = A070939(n) / A138904(n).
a(2^n) = n + 1 for any n >= 0.
a(2^n - 1) = 1 for any n >= 0.
a(A020330(n)) = a(n) for any n > 0.
EXAMPLE
The first terms, alongside the binary expansion of n with periodic part in parentheses, are:
n a(n) bin(n)
-- ---- ------
0 1 (0)
1 1 (1)
2 2 (10)
3 1 (1)(1)
4 3 (100)
5 3 (101)
6 3 (110)
7 1 (1)(1)(1)
8 4 (1000)
9 4 (1001)
10 2 (10)(10)
11 4 (1011)
12 4 (1100)
13 4 (1101)
14 4 (1110)
15 1 (1)(1)(1)(1)
16 5 (10000)
17 5 (10001)
18 5 (10010)
19 5 (10011)
20 5 (10100)
MATHEMATICA
Table[If[n==0, 1, Length[Union[Array[RotateRight[IntegerDigits[n, 2], #]&, IntegerLength[n, 2]]]]], {n, 0, 50}] (* Gus Wiseman, Apr 19 2020 *)
PROG
(PARI) a(n) = my (l=max(1, #binary(n))); fordiv (l, w, if (#Set(digits(n, 2^w))<=1, return (w)))
CROSSREFS
Aperiodic compositions are counted by A000740.
Aperiodic binary words are counted by A027375.
The orderless period of prime indices is A052409.
Numbers whose binary expansion is periodic are A121016.
Periodic compositions are counted by A178472.
Numbers whose prime signature is aperiodic are A329139.
Compositions by number of distinct rotations are A333941.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Necklaces are A065609.
- Sum is A070939.
- Runs are counted by A124767.
- Rotational symmetries are counted by A138904.
- Strict compositions are A233564.
- Constant compositions are A272919.
- Lyndon compositions are A275692.
- Co-Lyndon compositions are A326774.
- Aperiodic compositions are A328594.
- Rotational period is A333632.
- Co-necklaces are A333764.
- Reversed necklaces are A333943.
Sequence in context: A303119 A039775 A373953 * A300510 A361079 A302439
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Apr 04 2018
STATUS
approved