Let k be a positive integer. Find the number of non-negative integers n less than or equal to $10^k$ satisfying the following conditions: (i) n is divisible by 3; (ii) Each decimal digit of n is one of the digits 2,0,1 or 7.
Problem
Source: CHKMO
Tags: number theory
10.01.2017 20:11
A HK sequence is made up of $k$ numbers, each one is one of $2,0,1,7$. Let $a_k$ be the number of HK sequences such that the sum of the terms is $0 \bmod 3$; anagously $b_k$ and $c_k$ for $1 \bmod 3$ and $2\bmod 3$. Then \[a_k=a_{k-1}+b_{k-1}+2c_{k-1}\]\[b_k=2a_{k-1}+b_{k-1}+c_{k-1}\]\[c_k=a_{k-1}+2b_{k-1}+c_{k-1}\]Now it is easy to prove by induction that \[a_k=\frac{4^k-1}{3}+1\]when $3\mid k$ and \[a_k=\frac{4^k-1}{3}\]otherwise.
16.03.2017 23:32
This is a bit more technical proof Define the number $a_k^{(l)}$ as the number of k digit numbers equal to $l (mod 3)$ , where $l=0,1,2$ Let $\varepsilon=e^{2\pi i/3}= cos(2\pi /3) + isin(2\pi /3)$ Firstly observe that $1 + \varepsilon^1 + \varepsilon^2 = (\varepsilon^3-1)/(\varepsilon-1)=0$ Also observe that $\varepsilon^a = \varepsilon^b$ if $a \equiv b (mod 3)$ Having said that we proceed: $a_k^{(0)} + a_k^{(1)} + a_k^{(2)} = 4^n$ Also $a_k^{(0)} + a_k^{(1)}*\varepsilon^1 + a_k^{(2)}*\varepsilon^2=\sum_{x_1,x_2...x_k belong {0,1,2,7}}\varepsilon^{x_1+x_2+ ... + x_k} = (\varepsilon^0 + \varepsilon^1 + \varepsilon^2 + \varepsilon^7)^k = \varepsilon^k $ If 3 divides k then : $a_k^{(0)} + a_k^{(1)}*\varepsilon^1 + a_k^{(2)}*\varepsilon^2 = 1$ , which becomes $(a_k^{(0)} - 1 )+ a_k^{(1)}*\varepsilon^1 + a_k^{(2)}*\varepsilon^2 = 0$ and so we have $a_k^{(0)} - 1 = a_k^{(1)} = a_k^{(2)}$ and so $a_k^{(0)} = (4^k-1)/3 + 1$ The case where 3 does not divide k can be done similarly