百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
Y

yafu

> 编程语言
开源

自动整数因子分解

362 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

自动整数因子分解

YAFU — Yet Another Factoring Utility

Automated integer factorization.

YAFU (with assistance from other free software) uses the most powerful modern algorithms (and implementations of them) to factor input integers in a completely automated way.

YAFU has been referenced several times in the academic literature. If you have academic work that requires integer factorization, YAFU might be able to help.

For factorization help, support, and discussion, see the community at .

Detailed documentation lives in the project wiki. The wiki covers every option, every callable function, and a fuller version of the build instructions below.


Quick start

Use a pre-built Windows binary

Download from the latest release. All Windows builds are fully static — no extra DLLs required, runs in cmd.exe and PowerShell.

File Best for
yafu-windows-generic.exe Any x86-64 CPU — widest compatibility
yafu-windows-sse41.exe Intel Core 2 / Penryn (2008) and newer
yafu-windows-avx2.exe Haswell (2013) and newer — recommended for most users
yafu-windows-avx512.exe Skylake-X / Cascade Lake / Zen 4 (AVX-512)
yafu-windows-avx512ifma.exe Ice Lake and newer — best ECM performance

Not sure which to pick? Run wmic cpu get name in a Windows command prompt and look up your CPU generation, or just start with avx2 — it works on nearly every CPU sold since 2015.

First run

yafu "factor(rsa(200))"

Or launch the interactive prompt:

yafu
>> factor(2056802480868100646375721251575555494408897387375737955882170045672576386016591560879707933101909539325829251496440620798637813)

Files YAFU writes (logs, savefiles, yafu.ini) go next to the executable. No installation step is needed.


Building from source

Pre-built Windows binaries are provided, but building yourself, tuned to your CPU, will very likely be faster. The whole build is driven by a Makefile, configured per-machine through config.mk.

Dependencies

Required Optional
GMP — GMP-ECM — (for ECM factorization)
CUDA Toolkit (for GPU cofactorization / poly select / LA)
OpenCL (alternative to CUDA for cofactorization)

As of YAFU 3.0, ytools, ysieve, and msieve are bundled in this repository and built as part of the YAFU build.

Linux, WSL, and MSYS2/MinGW-w64

bash
cp config.mk.example config.mk          # first time only — edit paths as needed
make yafu                               # builds with sensible defaults (gcc)

Pass feature/ISA flags either on the command line or by uncommenting them in config.mk. The most useful ones are listed below. For the complete set, see the Building YAFU wiki page or run make help.

…

The first time you set up, copy config.mk.example to config.mk and edit any paths that differ from your system. config.mk is gitignored — only config.mk.example is tracked.

Other useful targets

Target Builds
yafu The main yafu executable
msieve The msieve static library + demo
siqs The siqs_demo standalone binary
ecm The ecm_demo standalone binary
all All four above
info Print the fully resolved configuration
help Show the feature-flag reference
clean Remove build artifacts

Windows — Visual Studio (MSVC)

Build files live under build.vc22/. To configure your build:

  1. Open build.vc22/yafu.sln in Visual Studio 2022 (the free Community edition is fine).
  2. Edit the property sheets in build.vc22/ for your environment:
    • Directory.Build.props — global build settings inherited by every project.
    • build_config.props — toolset selection (e.g. v143, Intel oneAPI) and global build configuration.
    • libs_and_extensions.props — paths to the dependency libraries and the ISA extensions to enable for this build.
  3. Build the yafu project under x64 / Release.

Dependencies for the MSVC build:

Dependency Source
mpir (or GMP)
ecm or
pthreads

These ship with their own MSVC build files. Build them first; then point YAFU at them via the paths in libs_and_extensions.props.

The free Intel compiler also works inside Visual Studio 2022.


Continuous integration & release builds

YAFU's release artifacts (the matrix of Windows .exe files shown above) are produced by an automated GitHub Actions pipeline that exercises:

  • Linux / gcc, via Makefile
  • Windows / MSYS2 / MinGW-w64 gcc, via Makefile with STATIC_WIN=1 for the fully-static binaries
  • Windows / MSVC, via the build.vc22/ solution and property sheets (this leg is being expanded for CI)

For every push, the CI builds the full matrix of ISA targets (generic, sse41, avx2, avx512, avx512ifma) on each platform. On tagged releases (e.g. v3.1.2), the resulting binaries are attached to the release page.

See the Continuous Integration wiki page for details on the matrix, the artifacts, and how the same Makefile flags drive both CI and local builds.


GGNFS sievers (required for NFS)

For NFS factorizations, YAFU needs external GGNFS lattice sieve binaries (ggnfs-lasieve4I*). Linux and MinGW binaries are bundled under factor/lasieve5_64/bin/. Point YAFU at them with ggnfs_dir= in yafu.ini, or -ggnfs_dir on the command line. Without these, NFS will not run.

If you have AVX-512 on your CPU, YAFU will also use AVX-ECM as the default ECM backend (built in). A standalone version lives at .


Help and documentation

Where What
help at the YAFU prompt Built-in help (reads docfile.txt)
help Per-function detail
docfile.txt Function reference (must sit next to the binary for help to work)
yafu.ini Every option, as commented lines
Project wiki All of the above, cross-referenced and searchable
Community / support

Fun examples

# Exercises many of yafu's algorithms
yafu "factor(2056802480868100646375721251575555494408897387375737955882170045672576386016591560879707933101909539325829251496440620798637813)"

# Neat example involving ecm and siqs
yafu "factor(140870298550359924914704160737419905257747544866892632000062896476968602578482966342704)"

If you build YAFU on a new platform or with a new compiler — or build a binary that beats one of the pre-compiled releases for a specific CPU — the maintainer would like to hear about it.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言