trial_step

std.elementwise.trial_step · Level L4

One step of trial division that records the factorization as it goes. Where d² ≤ m and d divides m, divide d out and record it: the smallest prime factor, the first time; a new distinct prime, with φ multiplied by (1 − 1/d) exactly; or a repeat, which makes the number not squarefree. Where d does not divide, move to the next candidate: 3 after 2, then odd numbers. The body factor_summary runs.

d | m: m ← m/d, record d; else d ← next candidate

Signature

trial_step(m: i64[s], d: i64[s], last: i64[s], spf: i64[s], omega: i64[s], sqf: i64[s], phi: i64[s]) → i64[s], i64[s], 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.

2mi64[s]omegai64[s]di64[s]lasti64[s]01spfi64[s]sqfi64[s]phii64[s]FloorDivqGreaterodd_stepMultiplyddModr1.0EqualunsetEqualsameSubtractdm1FloorDivpdCastodd_iGreaterpastEqualzero_rSubtractnot_sameMultiplypddAddincSubtractactAdddnMultiplydivWherem2WheredmoveWherelast2MultiplyfirstMultiplyrepMultiplynewpWhered2Castnewp_iWherespf2Castrep_iWherephi2Addomega2SubtractkeepMultiplysqf2m2i64[s]d2i64[s]omega2i64[s]last2i64[s]spf2i64[s]sqf2i64[s]phi2i64[s]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference trial division by d, recording the smallest prime factor, ω, squarefreeness and φ in exact rational arithmetic, on all 40 test cases.
  • All 1,015 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

Identity

Calls
—
Called by
sha256:c4ef6d7f81e71f4371bf021f9e9f3f89e55195e82a64d71fce1c3321acb28bfa

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

Control handle

Symbol
Ω:std.elementwise.trial_step · Ω:trial_step
Pins
sha256:85af246d72e736eaa3eafeaea3d45fb9e7e9870f7600b5097d49e7265d4ddcbathis graph alone
Evidence
sha256:fae1301f26ffa399e95bc3efa9d9c30cc639944b4b062676c00926839c20f6f5the 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.