A positive integer is happy if: 1. All its digits are different and not $0$, 2. One of its digits is equal to the sum of the other digits. For example, 253 is a happy number. How many happy numbers are there?
Problem
Source: 2022 Cono Sur #1
Tags: number theory, Digits
09.08.2022 23:06
We have $\binom{n-1}{m-1}$ numbers with all digits different from $0$, length $m$ and sum of numbers $n$. As we can place digit with $n$ in any position of $m+1$ positions and get different happy number( except case when $m=1$ ) than total we have $\sum_{m=1}^{n}(m+1)\binom{n-1}{m-1}-1$ happy numbers with biggest digit $n$ $ \sum_{m=1}^{n}(m+1)\binom{n-1}{m-1}-1=\sum_{m=2}^{n}(2\binom{n-1}{m-1}+(n-1)\binom{n-2}{m-2})+1=2^n-2+(n-1)2^{n-2}+1=(n+3)2^{n-2}-1$ And total there are $\sum_{n=1}^{9} ((n+3)2^{n-2}-1)=-9+\frac{1}{4}\sum_{n=1}^{9} (n+3)2^{n}=-9+(2^8*9+2^9-1)=2806$
10.08.2022 21:47
the problem in the test said that all the digits in the number were supposed to be distinct
11.08.2022 02:31
mathitoo wrote: the problem in the test said that all the digits in the number were supposed to be distinct If so, then it just some countings We have $6$ numbers with biggest digit equal 3, $6$ numbers for $4$, $12$ numbers for $5$,$36$ numbers for $6$, $42$ for $7$,$66$ for $8$,$96$ for $9$ and so total it is $264$