From the list of 3-tuples, how can I select tuples which contain one for more nines? [closed]Find positions of items in a list based on neighboursHow to delete list items that contain a non-numeric PartSelect out of nested listSelecting list elements depending if they contain sub-list elementsEliminating items from list by ruleSelect UPPER CASE list items with spaces and punctuationSelect sublists that contain $n$ odd numbersDeleting items from a list when they meet certain criteriaSelect data from a listSelect items in a list that contain criteria #2
Dmesg full of I/O errors, smart ok, four disks affected
How to remove stain from pavement after having dropped sulfuric acid on it?
What is the most suitable position for a bishop here?
Greeting with "Ho"
Why does Linux list NVMe drives as /dev/nvme0 instead of /dev/sda?
Counterfeit checks were created for my account. How does this type of fraud work?
Find the common ancestor between two nodes of a tree
How can a warlock learn from a spellbook?
Why does std::string_view create a dangling view in a ternary expression?
Subtract the Folded Matrix
Explain why a line can never intersect a plane in exactly two points.
A word for delight at someone else's failure?
Is there a term for the belief that "if it's legal, it's moral"?
Should I include an appendix for inessential, yet related worldbuilding to my story?
How did the Vostok ejection seat safely eject an astronaut from a sealed space capsule?
Is there any proof that high saturation and contrast makes a picture more appealing in social media?
Has a life raft ever been successfully deployed on a modern commercial flight?
Can i enter UK for 24 hours from a Schengen area holding an Indian passport?
Can the pre-order traversal of two different trees be the same even though they are different?
Why do you need to heat the pan before heating the olive oil?
What is the meaning of "понаехать"?
Is "Busen" just the area between the breasts?
Are there any individual aliens that have gained superpowers in the Marvel universe?
I found a password with hashcat, but it doesn't work
From the list of 3-tuples, how can I select tuples which contain one for more nines? [closed]
Find positions of items in a list based on neighboursHow to delete list items that contain a non-numeric PartSelect out of nested listSelecting list elements depending if they contain sub-list elementsEliminating items from list by ruleSelect UPPER CASE list items with spaces and punctuationSelect sublists that contain $n$ odd numbersDeleting items from a list when they meet certain criteriaSelect data from a listSelect items in a list that contain criteria #2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
From the list
Tuples[1, 2, 3, 4, 9, 3]
how can I select exactly those 3-tuples that contain one for more nines?
This is the result I want:
1, 1, 9, 1, 2, 9, 1, 3, 9, 1, 4, 9, 1, 9, 1 ... 9, 9, 4, 9, 9, 9
list-manipulation
$endgroup$
closed as off-topic by Daniel Lichtblau, Henrik Schumacher, ciao, user42582, AccidentalFourierTransform Jun 3 at 14:23
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, Henrik Schumacher, ciao, user42582, AccidentalFourierTransform
add a comment |
$begingroup$
From the list
Tuples[1, 2, 3, 4, 9, 3]
how can I select exactly those 3-tuples that contain one for more nines?
This is the result I want:
1, 1, 9, 1, 2, 9, 1, 3, 9, 1, 4, 9, 1, 9, 1 ... 9, 9, 4, 9, 9, 9
list-manipulation
$endgroup$
closed as off-topic by Daniel Lichtblau, Henrik Schumacher, ciao, user42582, AccidentalFourierTransform Jun 3 at 14:23
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, Henrik Schumacher, ciao, user42582, AccidentalFourierTransform
2
$begingroup$
Help > Wolfram Docuentation, enter "select" (with or without quotes). First hit is toSelect...
$endgroup$
– Daniel Lichtblau
Jun 2 at 11:59
add a comment |
$begingroup$
From the list
Tuples[1, 2, 3, 4, 9, 3]
how can I select exactly those 3-tuples that contain one for more nines?
This is the result I want:
1, 1, 9, 1, 2, 9, 1, 3, 9, 1, 4, 9, 1, 9, 1 ... 9, 9, 4, 9, 9, 9
list-manipulation
$endgroup$
From the list
Tuples[1, 2, 3, 4, 9, 3]
how can I select exactly those 3-tuples that contain one for more nines?
This is the result I want:
1, 1, 9, 1, 2, 9, 1, 3, 9, 1, 4, 9, 1, 9, 1 ... 9, 9, 4, 9, 9, 9
list-manipulation
list-manipulation
edited Jun 3 at 4:23
m_goldberg
90.6k873203
90.6k873203
asked Jun 2 at 7:25
CarbajoCarbajo
1105
1105
closed as off-topic by Daniel Lichtblau, Henrik Schumacher, ciao, user42582, AccidentalFourierTransform Jun 3 at 14:23
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, Henrik Schumacher, ciao, user42582, AccidentalFourierTransform
closed as off-topic by Daniel Lichtblau, Henrik Schumacher, ciao, user42582, AccidentalFourierTransform Jun 3 at 14:23
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, Henrik Schumacher, ciao, user42582, AccidentalFourierTransform
2
$begingroup$
Help > Wolfram Docuentation, enter "select" (with or without quotes). First hit is toSelect...
$endgroup$
– Daniel Lichtblau
Jun 2 at 11:59
add a comment |
2
$begingroup$
Help > Wolfram Docuentation, enter "select" (with or without quotes). First hit is toSelect...
$endgroup$
– Daniel Lichtblau
Jun 2 at 11:59
2
2
$begingroup$
Help > Wolfram Docuentation, enter "select" (with or without quotes). First hit is to
Select...$endgroup$
– Daniel Lichtblau
Jun 2 at 11:59
$begingroup$
Help > Wolfram Docuentation, enter "select" (with or without quotes). First hit is to
Select...$endgroup$
– Daniel Lichtblau
Jun 2 at 11:59
add a comment |
4 Answers
4
active
oldest
votes
$begingroup$
list=Tuples[1, 2, 3, 4, 9, 3] ;
Cases[___,9,___]@list
1, 1, 9, 1, 2, 9, 1, 3, 9, 1, 4, 9, 1, 9, 1, 1, 9, 2, 1,
9, 3, 1, 9, 4, 1, 9, 9,
2, 1, 9, 2, 2, 9, 2, 3, 9, 2,
4, 9, 2, 9, 1, 2, 9, 2, 2, 9, 3, 2, 9, 4, 2, 9, 9,
3, 1,
9, 3, 2, 9, 3, 3, 9, 3, 4, 9, 3, 9, 1, 3, 9, 2, 3, 9,
3, 3, 9, 4, 3, 9, 9,
4, 1, 9, 4, 2, 9, 4, 3, 9, 4, 4, 9, 4, 9, 1, 4, 9, 2, 4, 9, 3, 4, 9, 4, 4, 9, 9,
9, 1, 1, 9, 1, 2, 9, 1, 3, 9, 1, 4, 9, 1, 9, 9, 2, 1, 9, 2,
2, 9, 2, 3, 9, 2, 4, 9, 2, 9,
9, 3, 1, 9, 3, 2, 9, 3,
3, 9, 3, 4, 9, 3, 9, 9, 4, 1, 9, 4, 2, 9, 4, 3, 9, 4,
4, 9, 4, 9,
9, 9, 1, 9, 9, 2, 9, 9, 3, 9, 9, 4, 9, 9,
9
$endgroup$
add a comment |
$begingroup$
try
Select[Tuples[1,2,3,4,9,3],MemberQ@9]
1,1,9,1,2,9,1,3,9,1,4,9,1,9,1,1,9,2,1,9,3,1,9,4,1,9,9,2,1,9,2,2,9,2,3,9,2,4,9,2,9,1,2,9,2,2,9,3,2,9,4,2,9,9,3,1,9,3,2,9,3,3,9,3,4,9,3,9,1,3,9,2,3,9,3,3,9,4,3,9,9,4,1,9,4,2,9,4,3,9,4,4,9,4,9,1,4,9,2,4,9,3,4,9,4,4,9,9,9,1,1,9,1,2,9,1,3,9,1,4,9,1,9,9,2,1,9,2,2,9,2,3,9,2,4,9,2,9,9,3,1,9,3,2,9,3,3,9,3,4,9,3,9,9,4,1,9,4,2,9,4,3,9,4,4,9,4,9,9,9,1,9,9,2,9,9,3,9,9,4,9,9,9
$endgroup$
$begingroup$
This can even be shortened toSelect[Tuples[1,2,3,4,9,3], MemberQ[9]].
$endgroup$
– Henrik Schumacher
Jun 2 at 9:36
$begingroup$
@HenrikSchumacher nice!
$endgroup$
– J42161217
Jun 2 at 9:58
add a comment |
$begingroup$
L = Tuples[1, 2, 3, 4, 9, 3];
Pick[L, Total /@ UnitBox[L - 9], 1 | 2 | 3]
Or
Pick[L, Total /@ UnitStep[L - 8], 1 | 2 | 3]
$endgroup$
add a comment |
$begingroup$
lst // Pick[#, Times@@@(# /. 9-> 0), 0] &
and
Pick[lst,Times@@@(lst/. 9-> 0),0]==
Pick[lst, MemberQ[#,9]&/@lst]
$endgroup$
add a comment |
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
list=Tuples[1, 2, 3, 4, 9, 3] ;
Cases[___,9,___]@list
1, 1, 9, 1, 2, 9, 1, 3, 9, 1, 4, 9, 1, 9, 1, 1, 9, 2, 1,
9, 3, 1, 9, 4, 1, 9, 9,
2, 1, 9, 2, 2, 9, 2, 3, 9, 2,
4, 9, 2, 9, 1, 2, 9, 2, 2, 9, 3, 2, 9, 4, 2, 9, 9,
3, 1,
9, 3, 2, 9, 3, 3, 9, 3, 4, 9, 3, 9, 1, 3, 9, 2, 3, 9,
3, 3, 9, 4, 3, 9, 9,
4, 1, 9, 4, 2, 9, 4, 3, 9, 4, 4, 9, 4, 9, 1, 4, 9, 2, 4, 9, 3, 4, 9, 4, 4, 9, 9,
9, 1, 1, 9, 1, 2, 9, 1, 3, 9, 1, 4, 9, 1, 9, 9, 2, 1, 9, 2,
2, 9, 2, 3, 9, 2, 4, 9, 2, 9,
9, 3, 1, 9, 3, 2, 9, 3,
3, 9, 3, 4, 9, 3, 9, 9, 4, 1, 9, 4, 2, 9, 4, 3, 9, 4,
4, 9, 4, 9,
9, 9, 1, 9, 9, 2, 9, 9, 3, 9, 9, 4, 9, 9,
9
$endgroup$
add a comment |
$begingroup$
list=Tuples[1, 2, 3, 4, 9, 3] ;
Cases[___,9,___]@list
1, 1, 9, 1, 2, 9, 1, 3, 9, 1, 4, 9, 1, 9, 1, 1, 9, 2, 1,
9, 3, 1, 9, 4, 1, 9, 9,
2, 1, 9, 2, 2, 9, 2, 3, 9, 2,
4, 9, 2, 9, 1, 2, 9, 2, 2, 9, 3, 2, 9, 4, 2, 9, 9,
3, 1,
9, 3, 2, 9, 3, 3, 9, 3, 4, 9, 3, 9, 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, 1, 4, 9, 1, 9, 1, 1, 9, 2, 1,
9, 3, 1, 9, 4, 1, 9, 9,
2, 1, 9, 2, 2, 9, 2, 3, 9, 2,
4, 9, 2, 9, 1, 2, 9, 2, 2, 9, 3, 2, 9, 4, 2, 9, 9,
3, 1,
9, 3, 2, 9, 3, 3, 9, 3, 4, 9, 3, 9, 1, 3, 9, 2, 3, 9,
3, 3, 9, 4, 3, 9, 9,
4, 1, 9, 4, 2, 9, 4, 3, 9, 4, 4, 9, 4, 9, 1, 4, 9, 2, 4, 9, 3, 4, 9, 4, 4, 9, 9,
9, 1, 1, 9, 1, 2, 9, 1, 3, 9, 1, 4, 9, 1, 9, 9, 2, 1, 9, 2,
2, 9, 2, 3, 9, 2, 4, 9, 2, 9,
9, 3, 1, 9, 3, 2, 9, 3,
3, 9, 3, 4, 9, 3, 9, 9, 4, 1, 9, 4, 2, 9, 4, 3, 9, 4,
4, 9, 4, 9,
9, 9, 1, 9, 9, 2, 9, 9, 3, 9, 9, 4, 9, 9,
9
answered Jun 2 at 7:33
kglrkglr
199k10226453
199k10226453
add a comment |
add a comment |
$begingroup$
try
Select[Tuples[1,2,3,4,9,3],MemberQ@9]
1,1,9,1,2,9,1,3,9,1,4,9,1,9,1,1,9,2,1,9,3,1,9,4,1,9,9,2,1,9,2,2,9,2,3,9,2,4,9,2,9,1,2,9,2,2,9,3,2,9,4,2,9,9,3,1,9,3,2,9,3,3,9,3,4,9,3,9,1,3,9,2,3,9,3,3,9,4,3,9,9,4,1,9,4,2,9,4,3,9,4,4,9,4,9,1,4,9,2,4,9,3,4,9,4,4,9,9,9,1,1,9,1,2,9,1,3,9,1,4,9,1,9,9,2,1,9,2,2,9,2,3,9,2,4,9,2,9,9,3,1,9,3,2,9,3,3,9,3,4,9,3,9,9,4,1,9,4,2,9,4,3,9,4,4,9,4,9,9,9,1,9,9,2,9,9,3,9,9,4,9,9,9
$endgroup$
$begingroup$
This can even be shortened toSelect[Tuples[1,2,3,4,9,3], MemberQ[9]].
$endgroup$
– Henrik Schumacher
Jun 2 at 9:36
$begingroup$
@HenrikSchumacher nice!
$endgroup$
– J42161217
Jun 2 at 9:58
add a comment |
$begingroup$
try
Select[Tuples[1,2,3,4,9,3],MemberQ@9]
1,1,9,1,2,9,1,3,9,1,4,9,1,9,1,1,9,2,1,9,3,1,9,4,1,9,9,2,1,9,2,2,9,2,3,9,2,4,9,2,9,1,2,9,2,2,9,3,2,9,4,2,9,9,3,1,9,3,2,9,3,3,9,3,4,9,3,9,1,3,9,2,3,9,3,3,9,4,3,9,9,4,1,9,4,2,9,4,3,9,4,4,9,4,9,1,4,9,2,4,9,3,4,9,4,4,9,9,9,1,1,9,1,2,9,1,3,9,1,4,9,1,9,9,2,1,9,2,2,9,2,3,9,2,4,9,2,9,9,3,1,9,3,2,9,3,3,9,3,4,9,3,9,9,4,1,9,4,2,9,4,3,9,4,4,9,4,9,9,9,1,9,9,2,9,9,3,9,9,4,9,9,9
$endgroup$
$begingroup$
This can even be shortened toSelect[Tuples[1,2,3,4,9,3], MemberQ[9]].
$endgroup$
– Henrik Schumacher
Jun 2 at 9:36
$begingroup$
@HenrikSchumacher nice!
$endgroup$
– J42161217
Jun 2 at 9:58
add a comment |
$begingroup$
try
Select[Tuples[1,2,3,4,9,3],MemberQ@9]
1,1,9,1,2,9,1,3,9,1,4,9,1,9,1,1,9,2,1,9,3,1,9,4,1,9,9,2,1,9,2,2,9,2,3,9,2,4,9,2,9,1,2,9,2,2,9,3,2,9,4,2,9,9,3,1,9,3,2,9,3,3,9,3,4,9,3,9,1,3,9,2,3,9,3,3,9,4,3,9,9,4,1,9,4,2,9,4,3,9,4,4,9,4,9,1,4,9,2,4,9,3,4,9,4,4,9,9,9,1,1,9,1,2,9,1,3,9,1,4,9,1,9,9,2,1,9,2,2,9,2,3,9,2,4,9,2,9,9,3,1,9,3,2,9,3,3,9,3,4,9,3,9,9,4,1,9,4,2,9,4,3,9,4,4,9,4,9,9,9,1,9,9,2,9,9,3,9,9,4,9,9,9
$endgroup$
try
Select[Tuples[1,2,3,4,9,3],MemberQ@9]
1,1,9,1,2,9,1,3,9,1,4,9,1,9,1,1,9,2,1,9,3,1,9,4,1,9,9,2,1,9,2,2,9,2,3,9,2,4,9,2,9,1,2,9,2,2,9,3,2,9,4,2,9,9,3,1,9,3,2,9,3,3,9,3,4,9,3,9,1,3,9,2,3,9,3,3,9,4,3,9,9,4,1,9,4,2,9,4,3,9,4,4,9,4,9,1,4,9,2,4,9,3,4,9,4,4,9,9,9,1,1,9,1,2,9,1,3,9,1,4,9,1,9,9,2,1,9,2,2,9,2,3,9,2,4,9,2,9,9,3,1,9,3,2,9,3,3,9,3,4,9,3,9,9,4,1,9,4,2,9,4,3,9,4,4,9,4,9,9,9,1,9,9,2,9,9,3,9,9,4,9,9,9
edited Jun 2 at 9:58
answered Jun 2 at 7:33
J42161217J42161217
5,425525
5,425525
$begingroup$
This can even be shortened toSelect[Tuples[1,2,3,4,9,3], MemberQ[9]].
$endgroup$
– Henrik Schumacher
Jun 2 at 9:36
$begingroup$
@HenrikSchumacher nice!
$endgroup$
– J42161217
Jun 2 at 9:58
add a comment |
$begingroup$
This can even be shortened toSelect[Tuples[1,2,3,4,9,3], MemberQ[9]].
$endgroup$
– Henrik Schumacher
Jun 2 at 9:36
$begingroup$
@HenrikSchumacher nice!
$endgroup$
– J42161217
Jun 2 at 9:58
$begingroup$
This can even be shortened to
Select[Tuples[1,2,3,4,9,3], MemberQ[9]].$endgroup$
– Henrik Schumacher
Jun 2 at 9:36
$begingroup$
This can even be shortened to
Select[Tuples[1,2,3,4,9,3], MemberQ[9]].$endgroup$
– Henrik Schumacher
Jun 2 at 9:36
$begingroup$
@HenrikSchumacher nice!
$endgroup$
– J42161217
Jun 2 at 9:58
$begingroup$
@HenrikSchumacher nice!
$endgroup$
– J42161217
Jun 2 at 9:58
add a comment |
$begingroup$
L = Tuples[1, 2, 3, 4, 9, 3];
Pick[L, Total /@ UnitBox[L - 9], 1 | 2 | 3]
Or
Pick[L, Total /@ UnitStep[L - 8], 1 | 2 | 3]
$endgroup$
add a comment |
$begingroup$
L = Tuples[1, 2, 3, 4, 9, 3];
Pick[L, Total /@ UnitBox[L - 9], 1 | 2 | 3]
Or
Pick[L, Total /@ UnitStep[L - 8], 1 | 2 | 3]
$endgroup$
add a comment |
$begingroup$
L = Tuples[1, 2, 3, 4, 9, 3];
Pick[L, Total /@ UnitBox[L - 9], 1 | 2 | 3]
Or
Pick[L, Total /@ UnitStep[L - 8], 1 | 2 | 3]
$endgroup$
L = Tuples[1, 2, 3, 4, 9, 3];
Pick[L, Total /@ UnitBox[L - 9], 1 | 2 | 3]
Or
Pick[L, Total /@ UnitStep[L - 8], 1 | 2 | 3]
answered Jun 2 at 11:03
Okkes DulgerciOkkes Dulgerci
5,7231920
5,7231920
add a comment |
add a comment |
$begingroup$
lst // Pick[#, Times@@@(# /. 9-> 0), 0] &
and
Pick[lst,Times@@@(lst/. 9-> 0),0]==
Pick[lst, MemberQ[#,9]&/@lst]
$endgroup$
add a comment |
$begingroup$
lst // Pick[#, Times@@@(# /. 9-> 0), 0] &
and
Pick[lst,Times@@@(lst/. 9-> 0),0]==
Pick[lst, MemberQ[#,9]&/@lst]
$endgroup$
add a comment |
$begingroup$
lst // Pick[#, Times@@@(# /. 9-> 0), 0] &
and
Pick[lst,Times@@@(lst/. 9-> 0),0]==
Pick[lst, MemberQ[#,9]&/@lst]
$endgroup$
lst // Pick[#, Times@@@(# /. 9-> 0), 0] &
and
Pick[lst,Times@@@(lst/. 9-> 0),0]==
Pick[lst, MemberQ[#,9]&/@lst]
answered Jun 2 at 8:01
user1066user1066
6,29822033
6,29822033
add a comment |
add a comment |
2
$begingroup$
Help > Wolfram Docuentation, enter "select" (with or without quotes). First hit is to
Select...$endgroup$
– Daniel Lichtblau
Jun 2 at 11:59