1
$\begingroup$

For a positive integer n, let k(n) be the product of the digits of n when written in base 4. Find the number of integers n between 1 and 256 inclusive, such that k(n) > 0 and k(n) is divisible by 4.

I counted the case of 2 digits, 3 digits and 4 digits. Since the number's digit can only be 3 or below, there must exist two 2s in the digit. For 2 digit number, we have 22. For 3 digit number, we have 22(1/3/0) and it can be re-arranged to obtain 8 possibilities(note 022 is not a 3 digit number. ) Also 222 is one possible digit so we have 9 possiblities in toatl. For case of 222a, we have 11 cses in total. For case when it is 4 digit number, we have 22(1/3/0)(1/3/0). Counting separately for 22aa and 22ab, we have $(4C2)*3$ possibilities, which we minus 3 since 0202, 0220, 0022 is not possible . For 22ab, we have $(4C2)*3*2$ giving us 36 possible arrangement. However we need to minus case of 022(1/3) since it is not possible to obtain. Then we have 30 case of 22ab. 2222 also counts as one. Adding them we get 68. Is that correct?

  • 2
    This is not a question about linear algebra.2017-02-13
  • 0
    oops I thought base is a huge subject in algebra.... Where should I move this to?2017-02-13
  • 0
    Elementary number theory.2017-02-13
  • 0
    n between 1 and 256 -> n has up to 4 digits in base 4. k(n) > 0 -> n has no 0 in its digits. k(n) is multiple of 4 -> n has at least 2 2 in its digits (because n has no 0 in its digits).2017-02-13

1 Answers 1

1

All numbers can be written in the following forms:

Case $1$: As $4n+1$
Case $2$: As $4n+2$
Case $3$: As $4n+3$
Case $4$: As $4n $

For Case $1$: Observe that the ending place ends in the digit $1$. If $k (n)$ is to be divisible by $4$, the expansion of $n $ in base $4$ must have at least two $2$'s because a $4$ in the expansion becomes a $10$, for example, $17 =102$ and not $41$. Thus, the relevant cases are: $$221, 1221, 2121, 2211, 2221, 2231, 2321, 3221$$ in base $4$ that are all within the last number between $1$ and $256$ in the form of $4n+1$, that is, $253 =3331$ in base $4$.

For Case $2$: Here the expansion ends in the digit $2$, so atleast one $2$ in the expansion is necessary. Try to think about the arrangements of all numbers with this condition satisfied.

For Case $3$: Similar to case $1$ with the last digit being $3$ instead of $1$.

For Case $4$: The expansion will always contain a zero, thus violating the condition of $k (n) \neq 0$.

Hope you can take it from here.

  • 0
    Thanks I completely forget about the k(n) greater tahn 0 part. It makes the problem so much easier...2017-02-13
  • 0
    @19AlexZhang You can accept an answer if it helped you.2017-02-13