Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Conditions :-
- -------------
- Find a 10 digit number whose,
- first digit is divisible by 1,
- first two digits are divisible by 2,
- first three digits are divisible by 3,
- .
- .
- .
- and so on, without any repetition of digits.
- """
- from itertools import permutations as perm
- L1 = perm([_ for _ in range(10)], 10)
- for i in L1:
- flag = True
- for ind, val in enumerate(i):
- n = int("".join([str(i[_]) for _ in range(ind+1)]))
- if n%(ind+1):
- flag = False
- break
- if flag:
- print(n)
- """
- Output : 3816547290
- """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement