一键导入
count-combinations
For probability and counting: permutations, combinations, sample spaces, Monte Carlo simulation, brute-force enumeration, card/dice problems.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
For probability and counting: permutations, combinations, sample spaces, Monte Carlo simulation, brute-force enumeration, card/dice problems.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Conducts iterative deep research on any topic using web search, progressive exploration, and structured synthesis. Use when asked for comprehensive research, deep investigation, thorough analysis, or multi-source exploration of any topic. Triggers: research, investigate, deep dive, comprehensive analysis, explore thoroughly, find everything about.
For cross-cutting concerns: add behavior without modifying functions, caching, timing, logging, validation wrappers.
For performance work: measure before changing, profile to find bottlenecks, compare before and after.
For symbolic computation: ASTs, mathematical expressions, code that manipulates code structure, expression transformations.
For ordered processing: A* search, Dijkstra, event simulation, task scheduling. Efficient min/max extraction with heap-based queue.
For dynamic programming: overlapping subproblems, recursive solutions with repeated computations, memoization to avoid redundant work.
| name | count-combinations |
| description | For probability and counting: permutations, combinations, sample spaces, Monte Carlo simulation, brute-force enumeration, card/dice problems. |
Define sample space explicitly, then count favorable outcomes.
from fractions import Fraction
from itertools import combinations, permutations, product
def P(event, space):
"""Probability = favorable outcomes / total outcomes."""
favorable = event & space if isinstance(event, set) else {x for x in space if event(x)}
return Fraction(len(favorable), len(space))
# Sample spaces
die = {1, 2, 3, 4, 5, 6}
two_dice = {(a, b) for a in die for b in die}
deck = [r + s for r in 'A23456789TJQK' for s in 'SHDC']
hands = set(combinations(deck, 5))
# Events as sets or predicates
even = {2, 4, 6}
is_flush = lambda hand: len(set(c[1] for c in hand)) == 1
from fractions import Fraction
from itertools import combinations
def P(event, space):
"""The probability of an event, given a sample space."""
favorable = {x for x in space if x in event} if isinstance(event, set) \
else {x for x in space if event(x)}
return Fraction(len(favorable), len(space))
# Urn problem: 6 blue, 9 red, 8 white balls; draw 6
def balls(color, n):
return [f'{color}{i}' for i in range(1, n + 1)]
urn = balls('B', 6) + balls('R', 9) + balls('W', 8)
U6 = set(combinations(urn, 6))
def select(color, n, space=U6):
"""Event: exactly n balls of given color."""
return {s for s in space if sum(1 for b in s if b[0] == color) == n}
# Probability of drawing 3 blue, 1 red, 2 white
P(select('B', 3) & select('R', 1) & select('W', 2), U6)
# Returns: Fraction(240, 4807)
combinations, permutations, product