AGENT SKILL

factorial

Compute the factorial of a non-negative integer n, streaming each multiplication step. Use when asked to compute factorial, calculate n!, or demonstrate streaming math computation.

License 许可
MIT
最近更新
2026-05-31
Stars
★ 7
Forks
1

01 前言 Front Matter

name
factorial
license
MIT
description
Compute the factorial of a non-negative integer n, streaming each multiplication step. Use when asked to compute factorial, calculate n!, or demonstrate streaming math computation.
compatibility
Python 3.11+

02 资源文件 3

03 SKILL.md 正文

What this skill does

Computes n! iteratively, yielding each multiplication step as a streamed chunk so the client can observe the computation in progress.

Input

  • n — non-negative integer

Output

Each step is streamed as a chunk:

start: 1
2: 2
3: 6
4: 24
5: 120

Gotchas

  • n = 0 returns 0! = 1 immediately (by definition).
  • Negative values raise ValueError.
  • The handler is an async generator — each step is a separate SSE chunk event.

04 同仓库更多 Skills