factor_summary

std.elementwise.factor_summary · Level L4

Trial division of each n ≥ 1, and four facts read from it: the smallest prime factor (0 for n = 1), ω(n), the number of distinct primes, whether n is squarefree, and Euler's φ(n). A While over trial_step that tries 2 and then odd d up to √n; what remains above 1 at the end is one more prime. The reference factors each n independently.

n = Π pᵢ^eᵢ: spf = min pᵢ, ω = #{pᵢ}, squarefree ⇔ all eᵢ = 1, φ = n·Π(1 − 1/pᵢ)

Signature

factor_summary(n: i64[s]) → i64[s], i64[s], i64[s], i64[s]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

0ni64[s]Multiplynil12Addsqf0Addd0While·trial_stepm_end, d_end, last_end, spf_end, omega_end, sqf_end, phi_endEqualunsetGreaterrestEqualagain_eqMaximumm_safeSubtractmm1MultiplytakeMultiplyagainFloorDivpmWherespfSubtractfreshMultiplypmmCastagain_iCastfresh_iWherephiSubtractkeepAddomegaMultiplysquarefreespfi64[s]omegai64[s]phii64[s]squarefreei64[s]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference factor n by trial division; read off min p, #distinct p, all exponents 1, n·Π(1 − 1/p) in exact rational arithmetic, on all 40 test cases.
  • All 652 int64 results are exact: the error is zero.
  • Interpreter and NumPy backend return bit-identical results.
  • At float32 too: the 40 test cases rounded to float32, and 40 of them exact, with zero error.
Accuracy in detail
correctly rounded (the int64 nearest the exact value)
100%
bit-equal to the NumPy formula in int64
100%
largest error, in units in the last place
0

Note

About √n/2 steps: for n up to 10⁹ that is up to 16,000 steps. max_steps is 10⁵. The verification uses n up to 10⁵.

Identity

sha256:cdf3f8640f4a692f3854673745d8f33b4d62f579ee2a25d38742330f6432dd29

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.

Control handle

Symbol
Ω:std.elementwise.factor_summary · Ω:factor_summary
Pins
sha256:07018931268b835f21468be42f2865d4710b7feabb8f6276a1cdacefa56ee88athis graph and the 2 it reaches through calls
Evidence
sha256:5f1ac294599f871245954891f5a6bf9c511de0f5323928e98f2a5515beb5f3b9the hash of its verification record
Needs
no capability: a pure function

Through NOVA’s control layer, the symbol launches this function only while the program still matches what it pins: a change to this graph, or to any graph it reaches, needs a migration first.

ΣEML 2026

Efficient New Language — a high-density semantic overlay for humans and AI agents.

This site’s demos run on the real EML toolchain, in your browser.

© 2026 EveMissLab (一言諾科技有限公司) / Neo.K. All rights reserved.