首页龙虾技能列表 › Pywayne Maths — 技能工具

Pywayne Maths — 技能工具

v0.1.0

Mathematical utility functions for factorization, digit counting, and large integer multiplication using Karatsuba algorithm. Use when solving number theory...

0· 561·0 当前·0 累计
by @wangyendt·MIT-0
下载技能包
License
MIT-0
最后更新
2026/2/26
安全扫描
VirusTotal
无害
查看报告
OpenClaw
可疑
medium confidence
The SKILL.md documents a Python library but provides no code or install instructions, so the skill as published cannot actually provide the claimed functions without additional, external installation — this gap is unexpected and could lead to unsafe behavior if the agent attempts to fetch/install packages automatically.
评估建议
This skill documents a Python library but ships no code and gives no install instructions. Before installing or enabling it, ask the publisher for the source code or a clear, trusted install method (e.g., a GitHub repo or an official PyPI package name and version). Do not allow an agent to auto-install an unknown PyPI package without vetting — that is a supply-chain risk. If you need these functions now, prefer a skill that includes its implementation or points to a verifiable upstream source. I...
详细分析 ▾
用途与能力
The skill claims to expose Python functions (pywayne.maths.get_all_factors, digitCount, karatsuba_multiplication) but the bundle contains no code files and no install spec. For the skill to work, the runtime must already have a package named pywayne (or similar) installed — not stated. That mismatch (documented API vs no shipped implementation or install guidance) is incoherent.
指令范围
SKILL.md only shows import statements and usage examples; it does not instruct the agent to read system files, environment variables, or external endpoints. However, it implicitly assumes the module exists in the environment; the lack of instruction about how to obtain it is an important omission.
安装机制
No install spec is provided (instruction-only). This is low immediate disk/write risk, but because the skill requires a Python module that isn't included, an agent or user might attempt to pip-install a package from PyPI or another source — introducing supply-chain risk if that occurs without vetting.
凭证需求
No environment variables, credentials, or config paths are requested. The declared environment/credential footprint is minimal and appropriate for a pure mathematical utility.
持久化与权限
Skill does not request always:true, does not modify other skills, and contains no installation scripts. It has no elevated persistence or privileges as published.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv0.1.02026/2/17

Initial release with number theory and digit analysis functions. - Added get_all_factors for listing all factors of a positive integer. - Added digitCount for counting occurrences of a specific digit from 1 to n. - Added karatsuba_multiplication for efficient large integer multiplication. - Included example usages and common applications in SKILL.md documentation.

● 无害

安装命令 点击复制

官方npx clawhub@latest install maths
镜像加速npx clawhub@latest install maths --registry https://cn.clawhub-mirror.com

技能文档

Mathematical utility functions for number theory, digit analysis, and optimized integer operations.

Quick Start

from pywayne.maths import get_all_factors, digitCount, karatsuba_multiplication

# Get all factors of a number factors = get_all_factors(28) print(factors) # [1, 2, 4, 7, 14, 28]

# Count digit occurrences count = digitCount(100, 1) print(count) # 21 (digit 1 appears 21 times in 1-100)

# Large integer multiplication product = karatsuba_multiplication(1234, 5678) print(product) # 7006652

Functions

get_all_factors

Return all factors of a positive integer.

get_all_factors(n: int) -> list

Parameters:

  • n - Positive integer to factorize

Returns:

  • List of all factors of n

Use Cases:

  • Number theory problems
  • Finding divisors
  • Simplifying fractions
  • Greatest common divisor (GCD) calculation

Example:

from pywayne.maths import get_all_factors

factors = get_all_factors(36) print(factors) # [1, 2, 3, 4, 6, 9, 12, 18, 36]

# Check if number is prime n = 17 factors = get_all_factors(n) if len(factors) == 2: # Only 1 and itself print(f"{n} is prime") else: print(f"{n} is not prime")

digitCount

Count occurrences of digit k from 1 to n.

digitCount(n, k) -> int

Parameters:

  • n - Positive integer, upper bound of counting range
  • k - Digit to count (0-9)

Returns:

  • Count of digit k in range [1, n]

Special Case:

  • When k = 0, counts all numbers with trailing zeros after n

Use Cases:

  • Digit frequency analysis
  • Number theory problems
  • Data analysis tasks

Example:

from pywayne.maths import digitCount

# Count digit 1 from 1 to 100 count = digitCount(100, 1) print(count) # 21

# Count each digit 0-9 in range 1-1000 for k in range(10): count = digitCount(1000, k) print(f"Digit {k}: {count} times")

karatsuba_multiplication

Multiply two integers using Karatsuba's divide-and-conquer algorithm.

karatsuba_multiplication(x: int, y: int) -> int

Parameters:

  • x - Integer multiplier
  • y - Integer multiplicand

Returns:

  • Product of x and y

Algorithm:

  • Karatsuba algorithm uses recursive divide-and-conquer to multiply large integers
  • Time complexity: O(n^log₂3) ≈ O(n^1.585)
  • More efficient than naive multiplication O(n²) for very large numbers

Use Cases:

  • Large integer multiplication
  • Algorithm optimization
  • Competitive programming
  • Cryptography applications

Example:

from pywayne.maths import karatsuba_multiplication

# Compare with standard multiplication a, b = 123456789, 987654321 result = karatsuba_multiplication(a, b) print(result) # 121932631112635269

# Verify assert result == a b

Common Applications

Prime Number Detection

from pywayne.maths import get_all_factors

def is_prime(n): factors = get_all_factors(n) return len(factors) == 2 and factors == [1, n]

print(is_prime(17)) # True print(is_prime(18)) # False

Greatest Common Divisor (GCD)

from pywayne.maths import get_all_factors

def gcd(a, b): factors_a = set(get_all_factors(a)) factors_b = set(get_all_factors(b)) common = factors_a & factors_b return max(common)

print(gcd(24, 36)) # 12

Digit Frequency Analysis

from pywayne.maths import digitCount

def digit_frequency(n): frequency = {} for k in range(10): frequency[k] = digitCount(n, k) return frequency

print(digit_frequency(1000)) # {0: 189, 1: 301, 2: 300, 3: 300, ...}

Large Number Calculations

from pywayne.maths import karatsuba_multiplication

# Very large numbers x = 123456789012345678901234567890 y = 9876543210987654321098765432109876

# Use Karatsuba for efficiency product = karatsuba_multiplication(x, y)

Notes

  • get_all_factors returns sorted unique factors
  • digitCount counts from 1 to n inclusive
  • karatsuba_multiplication is optimized for large integers (hundreds+ of digits)
  • For small integers, standard multiplication may be faster due to overhead
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务