login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A302295 a(n) is the period of the binary expansion of n (with leading zeros allowed). 2
1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 2, 4, 4, 4, 4, 1, 5, 4, 3, 5, 5, 2, 5, 5, 5, 5, 5, 3, 5, 5, 5, 1, 6, 5, 4, 6, 3, 6, 6, 6, 6, 6, 2, 6, 6, 3, 6, 6, 6, 6, 6, 4, 6, 6, 3, 6, 6, 6, 6, 6, 6, 6, 6, 1, 7, 6, 5, 7, 4, 7, 7, 7, 7, 3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 2, 7 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

Equivalently, a(n) is the least positive k such that n is a repdigit number in base 2^k.

See A302291 for the variant where leading zeros are not allowed.

LINKS

Rémy Sigrist, Table of n, a(n) for n = 0..10000

Index entries for sequences related to binary expansion of n

FORMULA

a(2^n) = n + 1 for any n >= 0.

a(2^n - 1) = 1 for any n >= 0.

a(n) <= A302291(n).

A059711(n) <= 2^a(n).

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    2    (01)(01)

   6    3    (110)

   7    1    (1)(1)(1)

   8    4    (1000)

   9    3    (001)(001)

  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    4    (0001)(0001)

  18    3    (10)(10)

  19    5    (10011)

  20    5    (10100)

PROG

(PARI) a(n) = for (k=1, oo, if (#Set(digits(n, 2^k))<=1, return (k)))

CROSSREFS

Cf. A059711, A302291.

Sequence in context: A057940 A097285 A057432 * A215467 A284266 A317988

Adjacent sequences:  A302292 A302293 A302294 * A302296 A302297 A302298

KEYWORD

nonn,base,easy

AUTHOR

Rémy Sigrist, Apr 04 2018

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 27 22:01 EDT 2022. Contains 357063 sequences. (Running on oeis4.)