Non duplicate digits and arrangement puzzle

  • Thread starter K Sengupta
  • Start date
  • Tags
    Puzzle
In summary: If there are any duplicate digits in the prefix, they will be removed when turning it into a set, so the length will be less than 8 and the condition will not be satisfied. This ensures that the digits in the prefix are all distinct.
  • #1
K Sengupta
113
0
B is a positive 8-digit base ten integer of the form PQRSTUVW that contains precisely 8 distinct digits from 1 to 9, and satisfies all of the following conditions:

(i) PQ is divisible by 2.
(ii) PQR is divisible by 3.
(iii) PQRS is divisible by 4.
(iv) PQRST is divisible by 5.
(v) PQRSTU is divisible by 6.
(vi) PQRSTUV is divisible by 7.
(vii) PQRSTUVW is divisible by 8.

Determine all possible value(s) that B can assume.
 
Physics news on Phys.org
  • #2
Quasi-brute force...

38165472

DaveE
 
  • #3
Using divisibility rules and after 6 pages of handwriting:
PQRSTUVW = 38165472
 
  • #4
It was a fun little programming exercise to do it in an efficient way:
12965408
30925864
36925840
38165472
72965480
78320416
78920456
80165472
92765408
my Python:
Code:
def finddigits2():
    def step(prefix,divisible):
        nextprefix = (prefix*10-1)/divisible*divisible
        while nextprefix < (prefix+1)*10-divisible:
            nextprefix += divisible
            if divisible < 8:
                step(nextprefix,divisible+1)
            else:
                if len(set(str(nextprefix))) == 8:
                    print nextprefix
    for f in range(1,10):
        step(f,2)
 
Last edited:
  • #5
Hey mXSCNT,

your program looks compact. Can you explain it a little bit especially how you dealt with the digits being distinct?
 
  • #6
I dealt with that in this line:
if len(set(str(nextprefix))) == 8:

str(nextprefix) writes the prefix as a string, such as 12965408 becomes "12965408". set(str(nextprefix)) turns the individual characters in the string into a set (ignoring duplicates) so in this case that would be set(['1','2','9','6','5','4','0','8']). len(set(str(nextprefix))) == 8 checks that the "length" of the set (the number of elements in the set) is 8.
 

Related to Non duplicate digits and arrangement puzzle

1. What is a non-duplicate digits and arrangement puzzle?

A non-duplicate digits and arrangement puzzle is a type of puzzle that involves arranging a set of digits in a specific order without any duplicates. It often involves using logic and deduction to determine the correct arrangement.

2. How do you solve a non-duplicate digits and arrangement puzzle?

To solve a non-duplicate digits and arrangement puzzle, you need to use logic and deduction to determine the correct order of the digits. You can start by looking for any clues or patterns in the given information and then use trial and error to test different arrangements until you find the correct one.

3. Are there any strategies or tips for solving non-duplicate digits and arrangement puzzles?

Yes, there are a few strategies that can help you solve non-duplicate digits and arrangement puzzles more efficiently. These include looking for any known relationships between the given digits, starting with the most constrained digit or position, and keeping track of the digits you have already used.

4. Can non-duplicate digits and arrangement puzzles have multiple solutions?

Yes, it is possible for non-duplicate digits and arrangement puzzles to have multiple solutions. However, most puzzles are designed to have only one unique solution, making it more challenging and satisfying to solve.

5. Are there any benefits to solving non-duplicate digits and arrangement puzzles?

Yes, solving non-duplicate digits and arrangement puzzles can have several benefits. It can improve your critical thinking and problem-solving skills, enhance your logical reasoning abilities, and provide a sense of accomplishment and satisfaction upon solving the puzzle.

Similar threads

  • General Discussion
Replies
1
Views
3K
  • General Discussion
Replies
3
Views
8K
  • General Discussion
Replies
2
Views
3K
  • Calculus and Beyond Homework Help
Replies
9
Views
1K
  • Programming and Computer Science
Replies
4
Views
2K
  • General Discussion
Replies
2
Views
4K
  • Math Proof Training and Practice
2
Replies
67
Views
8K
  • Introductory Physics Homework Help
Replies
8
Views
1K
  • Math Proof Training and Practice
3
Replies
100
Views
7K
  • Math Proof Training and Practice
2
Replies
67
Views
10K
Back
Top