

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
(list;
graph;
refs;
listen;
history;
text;
internal format)



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.


LINKS



FORMULA

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):
 Rotational symmetries are counted by A138904.
 Constant compositions are A272919.
 CoLyndon compositions are A326774.
 Aperiodic compositions are A328594.
Cf. A000031, A001037, A008965, A019536, A020330, A211100, A302295, A328595, A328596, A329312, A329313, A329326.


KEYWORD

nonn,base,easy


AUTHOR



STATUS

approved



