Unique number Part 1

Define subfactorial ( ! n !n ) as ! n = k = 0 n k ! ( 1 ) n k ( n k ) !n=\displaystyle \sum_{k=0}^n k!(-1)^{n-k}\binom n k

Find the six-digit number abcdef \overline{\text{abcdef}} such that ! a + ! b + ! c + ! d + ! e + ! f = abcdef !\text{a}+!\text{b}+!\text{c}+!\text{d}+!\text{e}+!\text{f}=\overline{\text{abcdef}} .


The answer is 148349.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Kyle T
Apr 1, 2019

First lets start by defining a couple things on the board

k! means k factorial, where 0!=1, 1!=1, 2!=2, 3!=6, etc.
the parenthesis (n, k) means n choose k, also written as n! / ( k! * (n-k)!)

once we have those defined we can calculate the subfactorial for each number 0-9 as follows:
!0 = 1
!1 = 0
!2 = 1
!3 = 2
!4 = 9
!5 = 44
!6 = 265
!7 = 1854
!8 = 14833
!9 = 133496

Now the brute forcing comes in, we can loop through every 6 digit number 000000-999999 and convert the digits into a sum using the conversion chart above. The first number to come back where the converted total equals the original number is our answer, 148349.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...