0
$\begingroup$

Here's a sequence of numbers:

0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4

Will the sequence ever contain "6", and if yes, at which position (assuming the first position is 1).

$\endgroup$
2
  • 1
    $\begingroup$ Obligatory OEIS: oeis.org/A007814 $\endgroup$ – Glorfindel Jun 12 '20 at 18:53
  • $\begingroup$ Hi, and welcome to PSE! There's a useful tag wiki on most tags here. To find it, click on the tag, and find the "Learn more..." link on the tag's page. For number sequences, the tag wiki links to this helpful meta article; the top answer will be useful in case you were wondering about the behaviour of the voters here. Once again, welcome, and happy puzzling! $\endgroup$ – Bass Jun 13 '20 at 16:03
5
$\begingroup$

Will the sequence contain a "6"

Yes

At what position

$64$

Reasoning

The $n$th element of the sequence represents the exponent of the largest power of $2$ which divides $n$.
Odd numbers are only divisible by $2^0 = 1$ so odd-numbered entries will always be $0$. The first time we get a $6$ is at entry $2^6 = 64$.

$\endgroup$
5
$\begingroup$

The sequence can be described by this rule:

Every second term is a $0$. After removing all the $0$'s,
Every second term is a $1$. After removing all the $1$'s,
Every second term is a $2$. After removing all the $2$'s,
...

Which means that:

The first $0$ is at position $2^0 = 1$.
The first $1$ is at position $2^1 = 2$.
The first $2$ is at position $2^2 = 4$.
...
The first $6$ is at position $2^6 = 64$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.