Combinations with X unique numbers in Python [on hold]
up vote
-2
down vote
favorite
I want to find combinations of 12 digits of numbers from 1-225 and then find which of these combinations contain only 6 unique numbers (eg: 123456123456).
Now i’ve managed to find the Itertools library for combinatorics but i can’t seem to figure out how to extract the ones with only 6 unique digits.
Any help would be appericiated.
python python-2.7 iterator combinatorics
New contributor
put on hold as unclear what you're asking by usr2564301, cricket_007, Thierry Lathuille, Netwave, jpp Nov 17 at 10:37
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
-2
down vote
favorite
I want to find combinations of 12 digits of numbers from 1-225 and then find which of these combinations contain only 6 unique numbers (eg: 123456123456).
Now i’ve managed to find the Itertools library for combinatorics but i can’t seem to figure out how to extract the ones with only 6 unique digits.
Any help would be appericiated.
python python-2.7 iterator combinatorics
New contributor
put on hold as unclear what you're asking by usr2564301, cricket_007, Thierry Lathuille, Netwave, jpp Nov 17 at 10:37
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
What does 225 have to do with this???
– Thierry Lathuille
Nov 17 at 9:07
I’m just stating the set i’m running the combinations on
– A.Hesham
Nov 17 at 10:47
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I want to find combinations of 12 digits of numbers from 1-225 and then find which of these combinations contain only 6 unique numbers (eg: 123456123456).
Now i’ve managed to find the Itertools library for combinatorics but i can’t seem to figure out how to extract the ones with only 6 unique digits.
Any help would be appericiated.
python python-2.7 iterator combinatorics
New contributor
I want to find combinations of 12 digits of numbers from 1-225 and then find which of these combinations contain only 6 unique numbers (eg: 123456123456).
Now i’ve managed to find the Itertools library for combinatorics but i can’t seem to figure out how to extract the ones with only 6 unique digits.
Any help would be appericiated.
python python-2.7 iterator combinatorics
python python-2.7 iterator combinatorics
New contributor
New contributor
New contributor
asked Nov 17 at 8:52
A.Hesham
11
11
New contributor
New contributor
put on hold as unclear what you're asking by usr2564301, cricket_007, Thierry Lathuille, Netwave, jpp Nov 17 at 10:37
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as unclear what you're asking by usr2564301, cricket_007, Thierry Lathuille, Netwave, jpp Nov 17 at 10:37
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
What does 225 have to do with this???
– Thierry Lathuille
Nov 17 at 9:07
I’m just stating the set i’m running the combinations on
– A.Hesham
Nov 17 at 10:47
add a comment |
What does 225 have to do with this???
– Thierry Lathuille
Nov 17 at 9:07
I’m just stating the set i’m running the combinations on
– A.Hesham
Nov 17 at 10:47
What does 225 have to do with this???
– Thierry Lathuille
Nov 17 at 9:07
What does 225 have to do with this???
– Thierry Lathuille
Nov 17 at 9:07
I’m just stating the set i’m running the combinations on
– A.Hesham
Nov 17 at 10:47
I’m just stating the set i’m running the combinations on
– A.Hesham
Nov 17 at 10:47
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
len(set(str(number)))
gives you the number of unique digits the integer variable number
has.
But then you'd have to loop through 10^12 digits. It's really inefficient. Just generate numbers that will qualify instead.
– Aravind Voggu
Nov 17 at 9:11
There have formats? I thought they are just decimal numbers.
– Aravind Voggu
Nov 17 at 9:17
add a comment |
up vote
0
down vote
This comprehension works:
[ int("".join(x)) for x in filter(lambda x: len(set(x)) == 6, itertools.combinations_with_replacement("1234567890", 12))]
A question. This here provides the combination for 0 to 9 with 6 unique, but what i want is combinations of numbers from 1-225, as in the numbers being separate values, for example instead of combining 0-9 to be “135790135790” i want it to treat it as “13 5 7 90 13 57 90” as in combine every number from 1-225 (5 numbers each time to form a 12 number set) rather than combine numbers from 0-9 and re-arrange them. I just noticed that i was not clear on that in my question so i apologize and thank you for your comment nonethless, it’s a hard problem i’m asking for.
– A.Hesham
Nov 17 at 12:43
The problem is that you need to provide an euristic to group that numbers, or do you mean any posible subcombination for any number?
– Netwave
Nov 17 at 13:36
What i mean is imagine there are boxed numbered from 1-225, i wanted the number of combinations of 5 boxes of them that forms a 12 digit number with 6 unique digits. I’ve been trying to figure it out for days but just can’t seem to do it.
– A.Hesham
Nov 18 at 1:04
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
len(set(str(number)))
gives you the number of unique digits the integer variable number
has.
But then you'd have to loop through 10^12 digits. It's really inefficient. Just generate numbers that will qualify instead.
– Aravind Voggu
Nov 17 at 9:11
There have formats? I thought they are just decimal numbers.
– Aravind Voggu
Nov 17 at 9:17
add a comment |
up vote
1
down vote
len(set(str(number)))
gives you the number of unique digits the integer variable number
has.
But then you'd have to loop through 10^12 digits. It's really inefficient. Just generate numbers that will qualify instead.
– Aravind Voggu
Nov 17 at 9:11
There have formats? I thought they are just decimal numbers.
– Aravind Voggu
Nov 17 at 9:17
add a comment |
up vote
1
down vote
up vote
1
down vote
len(set(str(number)))
gives you the number of unique digits the integer variable number
has.
len(set(str(number)))
gives you the number of unique digits the integer variable number
has.
answered Nov 17 at 9:08
Constantine32
22118
22118
But then you'd have to loop through 10^12 digits. It's really inefficient. Just generate numbers that will qualify instead.
– Aravind Voggu
Nov 17 at 9:11
There have formats? I thought they are just decimal numbers.
– Aravind Voggu
Nov 17 at 9:17
add a comment |
But then you'd have to loop through 10^12 digits. It's really inefficient. Just generate numbers that will qualify instead.
– Aravind Voggu
Nov 17 at 9:11
There have formats? I thought they are just decimal numbers.
– Aravind Voggu
Nov 17 at 9:17
But then you'd have to loop through 10^12 digits. It's really inefficient. Just generate numbers that will qualify instead.
– Aravind Voggu
Nov 17 at 9:11
But then you'd have to loop through 10^12 digits. It's really inefficient. Just generate numbers that will qualify instead.
– Aravind Voggu
Nov 17 at 9:11
There have formats? I thought they are just decimal numbers.
– Aravind Voggu
Nov 17 at 9:17
There have formats? I thought they are just decimal numbers.
– Aravind Voggu
Nov 17 at 9:17
add a comment |
up vote
0
down vote
This comprehension works:
[ int("".join(x)) for x in filter(lambda x: len(set(x)) == 6, itertools.combinations_with_replacement("1234567890", 12))]
A question. This here provides the combination for 0 to 9 with 6 unique, but what i want is combinations of numbers from 1-225, as in the numbers being separate values, for example instead of combining 0-9 to be “135790135790” i want it to treat it as “13 5 7 90 13 57 90” as in combine every number from 1-225 (5 numbers each time to form a 12 number set) rather than combine numbers from 0-9 and re-arrange them. I just noticed that i was not clear on that in my question so i apologize and thank you for your comment nonethless, it’s a hard problem i’m asking for.
– A.Hesham
Nov 17 at 12:43
The problem is that you need to provide an euristic to group that numbers, or do you mean any posible subcombination for any number?
– Netwave
Nov 17 at 13:36
What i mean is imagine there are boxed numbered from 1-225, i wanted the number of combinations of 5 boxes of them that forms a 12 digit number with 6 unique digits. I’ve been trying to figure it out for days but just can’t seem to do it.
– A.Hesham
Nov 18 at 1:04
add a comment |
up vote
0
down vote
This comprehension works:
[ int("".join(x)) for x in filter(lambda x: len(set(x)) == 6, itertools.combinations_with_replacement("1234567890", 12))]
A question. This here provides the combination for 0 to 9 with 6 unique, but what i want is combinations of numbers from 1-225, as in the numbers being separate values, for example instead of combining 0-9 to be “135790135790” i want it to treat it as “13 5 7 90 13 57 90” as in combine every number from 1-225 (5 numbers each time to form a 12 number set) rather than combine numbers from 0-9 and re-arrange them. I just noticed that i was not clear on that in my question so i apologize and thank you for your comment nonethless, it’s a hard problem i’m asking for.
– A.Hesham
Nov 17 at 12:43
The problem is that you need to provide an euristic to group that numbers, or do you mean any posible subcombination for any number?
– Netwave
Nov 17 at 13:36
What i mean is imagine there are boxed numbered from 1-225, i wanted the number of combinations of 5 boxes of them that forms a 12 digit number with 6 unique digits. I’ve been trying to figure it out for days but just can’t seem to do it.
– A.Hesham
Nov 18 at 1:04
add a comment |
up vote
0
down vote
up vote
0
down vote
This comprehension works:
[ int("".join(x)) for x in filter(lambda x: len(set(x)) == 6, itertools.combinations_with_replacement("1234567890", 12))]
This comprehension works:
[ int("".join(x)) for x in filter(lambda x: len(set(x)) == 6, itertools.combinations_with_replacement("1234567890", 12))]
answered Nov 17 at 9:13
Netwave
11.5k21942
11.5k21942
A question. This here provides the combination for 0 to 9 with 6 unique, but what i want is combinations of numbers from 1-225, as in the numbers being separate values, for example instead of combining 0-9 to be “135790135790” i want it to treat it as “13 5 7 90 13 57 90” as in combine every number from 1-225 (5 numbers each time to form a 12 number set) rather than combine numbers from 0-9 and re-arrange them. I just noticed that i was not clear on that in my question so i apologize and thank you for your comment nonethless, it’s a hard problem i’m asking for.
– A.Hesham
Nov 17 at 12:43
The problem is that you need to provide an euristic to group that numbers, or do you mean any posible subcombination for any number?
– Netwave
Nov 17 at 13:36
What i mean is imagine there are boxed numbered from 1-225, i wanted the number of combinations of 5 boxes of them that forms a 12 digit number with 6 unique digits. I’ve been trying to figure it out for days but just can’t seem to do it.
– A.Hesham
Nov 18 at 1:04
add a comment |
A question. This here provides the combination for 0 to 9 with 6 unique, but what i want is combinations of numbers from 1-225, as in the numbers being separate values, for example instead of combining 0-9 to be “135790135790” i want it to treat it as “13 5 7 90 13 57 90” as in combine every number from 1-225 (5 numbers each time to form a 12 number set) rather than combine numbers from 0-9 and re-arrange them. I just noticed that i was not clear on that in my question so i apologize and thank you for your comment nonethless, it’s a hard problem i’m asking for.
– A.Hesham
Nov 17 at 12:43
The problem is that you need to provide an euristic to group that numbers, or do you mean any posible subcombination for any number?
– Netwave
Nov 17 at 13:36
What i mean is imagine there are boxed numbered from 1-225, i wanted the number of combinations of 5 boxes of them that forms a 12 digit number with 6 unique digits. I’ve been trying to figure it out for days but just can’t seem to do it.
– A.Hesham
Nov 18 at 1:04
A question. This here provides the combination for 0 to 9 with 6 unique, but what i want is combinations of numbers from 1-225, as in the numbers being separate values, for example instead of combining 0-9 to be “135790135790” i want it to treat it as “13 5 7 90 13 57 90” as in combine every number from 1-225 (5 numbers each time to form a 12 number set) rather than combine numbers from 0-9 and re-arrange them. I just noticed that i was not clear on that in my question so i apologize and thank you for your comment nonethless, it’s a hard problem i’m asking for.
– A.Hesham
Nov 17 at 12:43
A question. This here provides the combination for 0 to 9 with 6 unique, but what i want is combinations of numbers from 1-225, as in the numbers being separate values, for example instead of combining 0-9 to be “135790135790” i want it to treat it as “13 5 7 90 13 57 90” as in combine every number from 1-225 (5 numbers each time to form a 12 number set) rather than combine numbers from 0-9 and re-arrange them. I just noticed that i was not clear on that in my question so i apologize and thank you for your comment nonethless, it’s a hard problem i’m asking for.
– A.Hesham
Nov 17 at 12:43
The problem is that you need to provide an euristic to group that numbers, or do you mean any posible subcombination for any number?
– Netwave
Nov 17 at 13:36
The problem is that you need to provide an euristic to group that numbers, or do you mean any posible subcombination for any number?
– Netwave
Nov 17 at 13:36
What i mean is imagine there are boxed numbered from 1-225, i wanted the number of combinations of 5 boxes of them that forms a 12 digit number with 6 unique digits. I’ve been trying to figure it out for days but just can’t seem to do it.
– A.Hesham
Nov 18 at 1:04
What i mean is imagine there are boxed numbered from 1-225, i wanted the number of combinations of 5 boxes of them that forms a 12 digit number with 6 unique digits. I’ve been trying to figure it out for days but just can’t seem to do it.
– A.Hesham
Nov 18 at 1:04
add a comment |
What does 225 have to do with this???
– Thierry Lathuille
Nov 17 at 9:07
I’m just stating the set i’m running the combinations on
– A.Hesham
Nov 17 at 10:47