Non duplicate digits and arrangement puzzle

  • Context: Graduate 
  • Thread starter Thread starter K Sengupta
  • Start date Start date
  • Tags Tags
    Puzzle
Click For Summary

Discussion Overview

The discussion revolves around a combinatorial puzzle involving an 8-digit integer B, which must contain distinct digits from 1 to 9 and satisfy several divisibility conditions. Participants explore methods to find all possible values of B through programming and mathematical reasoning.

Discussion Character

  • Exploratory, Technical explanation, Mathematical reasoning

Main Points Raised

  • Post 1 presents the problem statement, outlining the specific divisibility conditions for the integer B.
  • Post 2 suggests a quasi-brute force approach to solving the problem.
  • Post 3 shares a Python program designed to efficiently find valid combinations of digits that meet the criteria.
  • Post 4 requests clarification on the programming approach, particularly regarding the handling of distinct digits.
  • Post 5 explains the method used in the program to ensure that all digits are distinct by converting the number to a string and using a set to check for uniqueness.

Areas of Agreement / Disagreement

Participants appear to agree on the approach of using programming to tackle the problem, but there is no consensus on the completeness or correctness of the proposed solutions, as the discussion is still ongoing.

Contextual Notes

The discussion does not address potential limitations in the programming approach or any assumptions made regarding the properties of the digits or the divisibility rules.

Who May Find This Useful

Individuals interested in combinatorial problems, programming solutions to mathematical puzzles, or those exploring distinct digit arrangements may find this discussion relevant.

K Sengupta
Messages
113
Reaction score
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.
 
Mathematics news on Phys.org
Quasi-brute force...

38165472

DaveE
 
Using divisibility rules and after 6 pages of handwriting:
PQRSTUVW = 38165472
 
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:
Hey mXSCNT,

your program looks compact. Can you explain it a little bit especially how you dealt with the digits being distinct?
 
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.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
8K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 125 ·
5
Replies
125
Views
20K
  • · Replies 67 ·
3
Replies
67
Views
12K
  • · Replies 12 ·
Replies
12
Views
3K
  • Poll Poll
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 100 ·
4
Replies
100
Views
13K