Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
28 lines (25 loc) · 968 Bytes

File metadata and controls

28 lines (25 loc) · 968 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
How many different ways can you arrange 3 digits to find the product of a 2-digit number and a 1-digit number?
"""
# find the smallest 3 digit number that is a multiple of a two digit number and an one-digit number
# it is 100 (= 2 x 50)
# and maximum is 891 (=9*99)
# run a loop from 100 to 891 to find the other 3 digits number between them, which are multiples of ...
multiples = []
for i in range(100,892):
for j in range(2,10):
if i % j == 0:
multiples.append(i)
break
# print(multiples) # these multiples are the possible 3-digit numbers
print(f'Total {len(multiples)} multiples are available.')
# now we have to find number of ways, each digit place can be arranged
digit = {}
for number in multiples:
for pos,digits in enumerate(str(number)):
if digits in digit.keys():
digit[digits] = digit[digits] + 1
else:
digit[digits] = 1
print(digit)
# thus our answer should be 610
Morty Proxy This is a proxified and sanitized view of the page, visit original site.