All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Four generations (Posted on 2020-07-06) Difficulty: 3 of 5
Let S be a set of all six-digit integers.

Let S1 be a subset of S, including all members of S such that each consists
of distinct digits.
Let S2 be a subset of S1, including all members of S1 each with 5 being the difference between its largest digit and its lowest one.
Let S3 be a subset of S2, comprising all elements of S2 divisible by 143.

What is the cardinality of S3 ?

Explain your way of reasoning.

No Solution Yet Submitted by Ady TZIDON    
Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Better late than never. Computer solution Comment 9 of 9 |
Output of the Python program which follows is:
Cardinality of S:   900000
Cardinality of S1:  136080
Cardinality of S2:  3480
Cardinality of S3:  0
 ---------
s0 = []
s1 = []
s2 = []
s3 = []
for i in range(100000,1000000):
    s0.append(i)
    if len(list(str(i))) == len(set(list(str(i)))): # because sets have no duplicate members
        s1.append(i)
        max_i = -1  # temporary
        min_i = 11  # temporary
        ilist = [int(c) for c in str(i)]  # convert integer to list of digits
        for j in ilist:
            max_i = max(max_i,j)
            min_i = min(min_i,j)
        if max_i - min_i == 5:
            s2.append(i)
            if i % 143 == 0:
                s3.append(i)
               

print('Cardinality of S:  ',len(s0))          
print('Cardinality of S1: ',len(s1))
print('Cardinality of S2: ',len(s2))
print('Cardinality of S3: ',len(s3))

  Posted by Larry on 2020-07-07 08:39:15
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information