Fixed.u32_np: def of bend-collections-laws-math@1.0.0.0 Import: import bend-collections-laws-math@1.0.0.0/src/math/fixed.bend as Fixed Lines 222-233 of bend-collections-laws-math@1.0.0.0/src/math/fixed.bend: https://jend.leeeet.dev/read.txt?path=bend-collections-laws-math@1.0.0.0/src/math/fixed.bend&start_line=222&end_line=233 import Base import bend-collections-laws-math@1.0.0.0/src/math/number.bend as NB # the least prime above n below 2^32: the candidates n+1, n+2, ... stop at # the first prime or when the next candidate wraps to 0 def u32_np(fuel: Nat, +m: U32, wrapped: Bool, prime: Bool) -> Maybe<&2, U32>: match fuel wrapped prime: case 0n _ _: None{} case 1n+f True{} _: None{} case 1n+f False{} True{}: Some{m} case 1n+ +f False{} False{}: u32_np(f, U32.add(m, 1), U32.is_zero(U32.add(m, 1)), NB.is_prime(U32.to_nat(U32.add(m, 1)))) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_zero https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=bend-collections-laws-math@1.0.0.0/src/math/number.bend&name=is_prime