08-10-2009 06:41 AM
08-10-2009 06:57 AM
And for today...........
Find a number consisting of 9 digits in which each of the digits from 1 to 9 appears only once. This number should satisfy the following requirements:
08-10-2009 06:57 AM
08-10-2009 10:29 AM
muks wrote:
Find a number consisting of 9 digits in which each of the digits from 1 to 9 appears only once. This number should satisfy the following requirements:
a. The number should be divisible by 9.
b. If the most right digit is removed, the remaining number should be divisible by 8.
c. If then again the most right digit is removed, the remaining number should be divisible by 7.
d. etc. until the last remaining number of one digit which should be divisible by 1.
OK, to bring this topic back to LabVIEW, we want to see some actual LabVIEW code to solve this. 😄
(I probably won't have time this week, though... :()
08-10-2009 12:38 PM
altenbach wrote:we want to see some actual LabVIEW code to solve this. 😄
My thought too, but my quick examination revealed it would take longer to write the divisibility checks and the surrounding code than I wanted to put in.
What I can say is that I know what one of the digits is and that the rest can be divided into two groups of four which we know something about. The details are in white font below:
The fifth digit is 5.
The odd digits are odd and the even digits are even.
08-10-2009 07:07 PM
08-10-2009 08:47 PM
Looks good to me.
I'm curious about how you decided to break the even numbers into 2,6 or 4,8 for the particular positions. The even vs. odd I figured out on my own. The location of the 5 made sense once I read it. But you went once step further breaking up the evens. I'm curious what was your rationale for that?
08-10-2009 10:18 PM
08-10-2009 11:20 PM
08-10-2009 11:55 PM - edited 08-10-2009 11:58 PM
Who needs all these division rules??? 😮
Here's dumb, all blue solution the does not know anything about division and thus needs to try all permutations. It still solves the problem in under 1 second and even proves that there is only one solution.

I'ts probably buggy so feel free to modify it. I initially wrote it in 8.6 using the "in-place structure". Unfortunately, this structure is not available in the posted 8.0 version.
you can even change the number of digits. There are/is:
no solution for n=4, 5, or 7
one solution for n=9 (381654729),n=8 (38165472), n=2 (12), or n=1 (1)
two solutions for n=6 (123654, 321654), or n=3 (123, 321)