Documentation / LearningLemur

  • Demos
  • Visit our website
  • Contact us
  • MathType

    • Wiris Quizzes

      • Learning Lemur

        • CalcMe

          • MathPlayer

            • Store FAQ

              • VPAT for the electronic documentation

                • MathFlow

                  • BF FAQ

                    • Home
                    • Learning Lemur
                    • Basic guide to Learning Lemur
                    • Using advanced logic
                    • Glossary of commands
                    • Glossary of commands

                    Arithmetic

                    Reading time: 3min

                    This section includes core functions that help you work with numbers and their properties—like divisibility, rounding, remainders, primes, rational numbers, and number formats (like decimals or hexadecimal). These are essential tools when generating or checking numerical values in your exercises.

                    Example classroom uses

                    • Generate a pair of integers witha known gcd and ask students to simplify a fraction. 
                    • Create a list of divisors for a number and ask which are prime. 
                    • Use floor, round or decimal when introducing apporximation and estimation. 

                    👉Need concrete examples? Check out the Examples section to see how these functions are used in real exercises. It’s a great place to see how to combine random value generation, conditions, and solution logic in context.

                     

                    Functions

                    absolute

                    Given a number, returns the absolute value. 

                    absolute(Real)
                     
                     

                    decimal

                    Given a number, returns the decimals. 

                    decimal(Real) 
                    decimal(Complex)
                     
                     

                    denominator

                    Given a fraction, returns the denominator.

                    denominator(Fraction) 
                     
                     

                    divisors

                    Given a number, returns the divisors.

                    divisors(Integer) 
                    divisors(Integer, Boolean) 

                    Given an integer, returns a list with the positive divisors in ascending order. Given an integer and a boolean b, if b=false it is the same as divisors(Integer); if b=true it returns the negative divisors too. 

                     
                     

                    factor

                    Given an integer, returns the prime factorization.

                    factor(Integer) 

                    Given an integer n, returns the number decomposed in prime factors. 

                     
                     

                    floor

                    Given a number, returns the greatest integer that is less than or equal to it. 

                    floor(Real) 
                    floor(Complex) 

                    Given a real number x, returns the greates integer that is lower than or equal to x. 

                    Given a complex number z, returns a complex number with the floor function applied to its real and imaginary parts. 

                     
                     

                    gcd

                    Given a set of integers, returns the greatest common divisor.  

                    gcd(Integer, ..., Integer) 
                    gcd(List)
                    gcd(Vector) 
                    gcd(Fraction, Fraction) 

                    Given a set of integers a1,…,an, returns the largest number that divides a1,…,an simultaneously.

                    Given a list of integers {a1,…,an}, returns the largest number that divides a1,…,an simultaneously. 

                    Given a vector of integers [a1,…,an], returns the largest number that divides a1,…,an simultaneously. 

                    Given two fractions a/b and c/d, returns its greatest common divisor defined as: 

                     
                     

                    hexadecimal

                    Given a number, returns the hexadecimal representation.

                    hexadecimal(Real) 

                    Given an integer n in decimal base, returns a string with its representation in the hexadecimal system. 

                     
                     

                    lcm

                    Given a set of integers, returns the least common multiple.

                    lcm(Integer, ..., Integer) 
                    lcm(List) 
                    lcm(Vector) 
                    lcm(Fraction, Fraction)

                    Given a set of integers a1,…,an, returns the least number that is a multiple of a1,…,an simultaneously.

                    Given a list of integers {a1,…,an}, returns the least number that is a multiple of a1,…,an simultaneously. 

                    Given a vector of integers [a1,…,an], returns the least number that is a multiple of a1,…,an simultaneously. 

                    Given two fractions a/b and c/d, returns its least common multiple defined as: 

                     
                     

                    mod

                    Given a division of one number by another, returns the remainder. 

                    Integer mod Integer
                    Fraction mod Integer

                    Given two integers a and m, returns the remainder of the division a/m. 

                    Given a fraction a/b and an integer m, returns a·b-1 mod m, as long as b is invertible modulo m. 

                     
                     

                    negative?

                    Given a number, checks if it is negative. 

                    negative?(Real)

                    Given a real number x, returns true if it is negative, and false otherwise. 

                     
                     

                    numerator

                    Given a fraction, returns the numerator

                    numerator(Fraction)

                    Given a fraction, returns an expression with the numerator. 

                     
                     

                    positive?

                    Given a number, checks if it is postivie. 

                    positive?(Real)

                    Given a real number x, returns true if it is positive, and false otherwise. 

                     
                     

                    prime

                    Returns a prime number

                    prime(Integer)

                    Given an integer n, returns the n-th prime. 

                     
                     

                    prime?

                    Given a number, checks if it is a prime. 

                    prime?(Integer)

                    Given an integer n, returns true if it is prime, and false otherwise. 

                     
                     

                    prime_power?

                    Given a number, checks if it is a prime power.

                    prime_power?(Integer)

                    Given an integer n, returns false if the input is not a prime power. If indeed it is a prime power returns a list with two elements: the first one is the prime and the second one is the power. 

                     
                     

                    quotient

                    Given two integers, computes the quotient of the division. 

                    quotient(Integer, Integer)

                    Given two integers a and b, the operation a divided by b, with a≥b. Then the equality a=q·b+r; has quotient q and remainder r. This function returns q. 

                     
                     

                    quotient_and_remainder

                    Given two integers, computes the quotient and remainder of the division. 

                    quotient_and_remainder(Integer, Integer)

                    Given two integers a and b, the operation a divided by b, with a≥b. Then the equality a=q·b+r; has quotient q and remainder r. This function returns a list: the first element is the quotient, and the second is the remainder. 

                     
                     

                    rational

                    Given a decimal number, converts it into a rational number (in its fraction expression), if possible. 

                    rational(Rational)

                    Given a rational number a, returns its fraction form. 

                     
                     

                    rationalize

                    Given a fraction, rationalizes it. 

                    rationalize(Fraction)

                    Given a fraction, rationalize stands for simplifying the fraction and taking off the denominator those radicals. 

                     
                     

                    remainder

                    Given two integers, computes the remainder of the division.  

                    remainder(Integer, Integer)

                    Given two integers a and b, the operation a divided by b, with a≥b. Then the equality a=q·b+r; has quotient q and remainder r. This function returns r. 

                     
                     

                    round

                    Given a number, rounds it to its closest integer

                    round(Real)
                    round(Complex)

                    Given a real number x, returns its closest integer. 

                    Given a complex number z, returns a complex number with the round function applied to its real and imaginary parts. 

                     
                     

                    sign

                    Given a number, returns the sign. 

                    sign(Real)
                    sign(Complex)

                    Given a real number x, returns 0 if x=0, 1 if x>0 and -1 if x<0. 

                    Given a complex number z, returns 0 if z=0 and z/|z| if z≠0. 

                     
                     

                    Was this article helpful?

                    Yes
                    No
                    Give feedback about this article

                    Related Articles

                    • Analysis

                    Arithmetic

                    Example classroom uses Functions absolute decimal denominator divisors factor floor gcd hexadecimal lcm mod negative? numerator positive? prime prime? prime_power? quotient quotient_and_remainder rational rationalize remainder round sign

                    Making people’s STEM work more meaningful

                    MathType

                    • MathType for Office Tools
                    • MathType for Mac
                    • MathType for Microsoft 365
                    • MathType for Google Workspace
                    • MathType for LMS
                    • MathType for XML Editors
                    • Arabic notation
                    • Our products accessibility
                    • MathType is online

                    WirisQuizzes

                    Learning Lemur

                    Solutions for Education

                    • Blackboard Learn
                    • Brightspace by D2L
                    • Canvas
                    • Google Classroom
                    • Moodle
                    • Schoology

                    Solutions for Publishing Houses

                    Solutions for Technical Writers

                    Solutions for Chemistry

                    Integrations

                    • HTML Editors
                    • MathType in WordPress

                    Pricing

                    Company

                    Careers

                    Blog

                    Contact Us

                    Buy Now

                    Plugin Downloads

                    © Wiris 2025

                    • Cookie Settings
                    • Cookie Policy
                    • Terms of Use
                    • Privacy Policy / GDPR
                    • Student Data Privacy
                    • Compliance
                    • Powered by Helpjuice
                    Expand