BrainDen.com - Brain Teasers
• 0

# logic or trial&error?

## Question

Given the sum and the product of the digits of a 7-digit even number with distinct digits that is divisible by the product, is it possible to figure out the number?

Eg:  Given : sum of the digits=36, product of the digits=18144. Also given:  the 7 digit number with distinct digits is divisible by the product 18144.

how do you figure out the 7-digit even number as 1687392?

## Recommended Posts

• 0

I don't think you can pin down the number strictly with logic. Once you know that the digits are 1 2 3 6 7 8 and 9, you simply check all multiples of 18144 between 1236789 and 9876321. Those are 18144*69 thru 18144*544, and you can skip the multiples of 5.

##### Share on other sites

• 0

It might be solvable, iteratively. I once posted a puzzle, here or elsewhere, that went as follows:

Spoiler

I've constructed a 7-digit palindromic number of the form A B C D C B A,
where 9 >= A >= B >= C >= 0, and 9 >= D >= 0. (2200 possibilities.)
I tell Moe the sum of the seven digits, and I tell Joe their product.
They converse:

Moe: I don't know the product. (Knowing only the sum reduces 2200 to 2177 possibilities
.)
Joe: I don't know the sum. (Knowing the product now reduces that to 1844 possibilities.)
Moe: I still don't know the product. (Knowing the sum now reduces that to 1825 possibilities.)
Joe: Now I know the number. (Knowing the product now reduces that to only a single possibility.)

What is the number?

greylabyrinth dot com /discussion/viewtopic.php?p=553027

But in that puzzle information was added as the constraints were iteratively applied. Here it seems it must all be determined in one shot. So maybe that's not possible.

##### Share on other sites

• 0

Give it a try:

Spoiler

Seven-digit number N with distinct digits.
Product is 18144
Sum is 36
Number is multiple M of Product: N = 18144 M
Find N.

Determine the seven unique digits:

The prime factorization of 18144 is (7 3 3 3 3 2 2 2 2 2).

• Seven distinct digits can be formed only one way: {(3x3) (2x2x2) 7 (3x2) 3 2 1} = {9 8 7 6 3 2 1}
• Their sum is indeed 36; we only needed to know the product.
• Since the number N is a multiple M of 18144, we didn't have to be told it's even.
• Since 1236798 < N < 9876312, we know that 69 < M < 544.

Now write N = abcdefg = 1000000a + 100000b + 10000c + 1000d + 100e + 10f + g.
We know g is one of {2 6 8}.
Combinatorially, N is one of 3x6x5x4x3x2x1 = 2160 even numbers.
But N is also one of only 476 numbers of the form 18144 M where 69 < M < 544.

So that is the statement of the problem: find the single number N that is in both of these sets.

A simple approach is to write a program that loops through the 2160 possible numbers and test each of them for multiples of 18144,.

There are also some formulas for digit sums of sums and products of numbers that might be useful.

I'll give this more thought.
If anyone wishes to start from here and eliminate candidate numbers, feel free to do so.

##### Share on other sites

• 0

Brute force

Spoiler

There are 2160 even permutations of the digits {1 2 3 6 7 8 9}, 720 each ending in 2, 6 and 8.
Checking for multiples of 18144 = 1x2x3x6x7x8x9, only one is found, namely
1687392.

Has anyone found a constructive solution?

##### Share on other sites

• 0

Not constructive, but only 174 possibilities to check.

Spoiler

abcdefg is divisible by its product (a*b*c*d*e*f*g) where a,b,c,d,e,f,g are distinct digits

1) There is no 0 in abcdefg since the product cannot be 0, nothing is divisible by 0.
2) There is no 5 in abcdefg since 7 digits out of {1,..,9} mean at least one is even and if the product contains 5 that means the product is divisible by 10 so the last digit is 0, contradiction.
3) 8 possible digits left of which 9 is definitely a digit. If there were no 9 in abcdefg then 3 would be in the product of digits and the sum would be 1+2+3+4+6+7+8 = 8*9/2-5 = 31 which is not divisible by 3.
4) There is no 4 in abcdefg. Since 9 is a digit and the sum of all digits from 1 to 9 except for 5 is 9*10/2-5=45-5=40, the only way to make the sum of digits divisible by 9 is to remove 4 yielding the sum 36.
5) From the above, abcdefg contains 1,2,3,6,7,8,9 hence the product is 18144 and the sum is 36.
a*b*c*d*e*f*g = 18144
a+b+c+d+e+f+g = 36

which brings us to the original post.
6) 18144 = 7*81*32 = 7*3^4*2^5. There are rules of divisibility for powers of two (2^N) that take into account the fact that the last N digits are relevant since the others are multiplied by 10^N so will not change divisibility.
g is divisible by 2 so 2,6,8.
fg is divisible by 4 so 12, 32, 72, 92, 16, 36, 76, 96, 28, 68.
efg is divisible by 8 so 312, 712, 912, 632, 832, 672, 872, 192, 392, 792, 216, 816, 136, 736, 936, 176, 376, 976, 296, 896, 128, 328, 728, 928, 168, 368, 768, 968.
defg is divisible by 16 so 7312, 9312, 3712, 9712, 6912, 8912, 1632, 7632, 9632, 6832, 8672, 1872, 3872, 9872, 6192, 8192, 1392, 7392, 1792, 3792, 3216, 7216, 9216, 2816, 7136, 9136, 2736, 8736, 1936, 7936, 2176, 8176, 1376, 9376, 2976, 8976, 1296, 3296, 7296, 2896, 6128, 1328, 7328, 9328, 1728, 3728, 9728, 6928, 3168, 7168, 9168, 2368, 2768, 1968, 3968, 7968.
cdefg is divisible by 32 so 97312, 69312, 89312, 63712, 83712, 39712, 86912, 38912, 78912, 81632, 17632, 97632, 89632, 16832, 76832, 96832, 31872, 91872, 63872, 19872, 39872, 36192, 76192, 68192, 71392, 67392, 87392, 61792, 81792, 13792, 73216, 93216, 37216, 97216, 89216, 27136, 87136, 79136, 12736, 92736, 28736, 71936, 27936, 87936, 82176, 38176, 98176, 21376, 81376, 29376, 89376, 82976, 18976, 38976, 31296, 71296, 83296, 87296, 12896, 32896, 72896, 36128, 76128, 96128, 71328, 91328, 67328, 19328, 79328, 61728, 13728, 93728, 69728, 16928, 36928, 76928, 23168, 27168, 39168, 79168, 12768, 32768, 92768, 31968, 71968, 23968, 27968.

87 possibilities. It looks like brute force but it's easy to construct with pen&paper in under 30 minutes (and 1 cup of coffee).

Last two digits a and b are known for each possibility so that means 2*87 = 174 combinations to try divisibility with 18144.

I). I haven't found a use for divisibility with 7. I know of two criteria:
i) from left-to-right take digits and multiply with 1-3-2-6-4-5 so g + 3f + 2e + 6d + 4c + 5b + a is divisible by 7
ii) abcdef-2*g is divisible by 7.

II) I haven't found a use for divisibility with 27 and 81 (actually I know of no rule for 81 that would work on 7 digit numbers)
For 27 the divisibility trick is to get blocks of 3 digits because 1000 = 1 (mod 27).
That means efg + bcd + a must be divisible with 27.

One could theoretically use one of these rules to narrow the space of solutions combined with the divisibility criteria for powers of 2 above.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account. ×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.