Created
February 16, 2016 16:19
-
-
Save harshithjv/fc490a904a06aba0b502 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| For implementation of digits_0to5 refer this gist: https://gist.github.com/harshithjv/969f4fb820dd96e4739c | |
| """ | |
| from base_5_generator import digits_0to5 | |
| from collections import Counter | |
| for i in digits_0to5(50000): | |
| i_str = str(i) | |
| digit_repr = tuple([int(j) for j in i_str]) | |
| num_counts = {'0':0, '1':0,'2':0,'3':0,'4':0} | |
| num_counts.update(dict(Counter(i_str))) | |
| num_counts_tuple = tuple([num_counts[str(k)] for k in range(5)]) | |
| if digit_repr == num_counts_tuple: | |
| print i | |
| break |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Puzzle description:
Its a 5 digit number where…
1st digit denotes how many zeroes are there in the number
2nd digit denotes how many ones are there in the number
3rd digit denotes how many twos are there in the number
4th digit denotes how many threes are there in the number
5th digit denotes how many fours are there in the number
Can you guess the number?
Answer:
Lets say there are 4 0’s, so number should be 40000, but this violates that 5th digit tells how many 4’s are there.
Now lets say there 3 0’s then number can be 30010, but thus also violates, 2nd digit tells number of 1’s
Now if there are 2 0’s then 21200 satisfies all the conditions.