Skip to content

LeastCommonMultiple

[Source]

Get the least common multiple of x and y where both x and y >= 1.

Providing 0 or numbers that overflow the integer width will result in an error.

Example usage:

use "math"

actor Main
  new create(env: Env) =>
    try
      let lcm = LeastCommonMultiple[U64](10, 20)?
      env.out.print(lcm.string())
    else
      env.out.print("No LCM")
    end
primitive val LeastCommonMultiple

Constructors

create

[Source]

new val create()
: LeastCommonMultiple val^

Returns


Public Functions

apply[A: (Integer[A] val & (U8 val | U16 val | U32 val | U64 val | U128 val | ULong val | USize val))]

[Source]

fun box apply[A: (Integer[A] val & (U8 val | U16 val | U32 val | 
    U64 val | U128 val | ULong val | 
    USize val))](
  x: A,
  y: A)
: A ?

Parameters

  • x: A
  • y: A

Returns

  • A ?

eq

[Source]

fun box eq(
  that: LeastCommonMultiple val)
: Bool val

Parameters

Returns


ne

[Source]

fun box ne(
  that: LeastCommonMultiple val)
: Bool val

Parameters

Returns