Scilab Home Page | Wiki | Bug Tracker | Forge | Mailing List Archives | Scilab Online Help | File Exchange
ATOMS : Number details
Login with GitLab


Integers algorithms
(9517 downloads for this version - 34057 downloads for all versions)
A more recent valid version exists: 1.4
Michael Baudin
Owner Organization
Consortium Scilab - DIGITEO, and others
Michael BAUDIN
Creation Date
July 16, 2012
Source created on
Scilab 5.4.x
Binaries available on
Scilab 5.4.x:
Windows 64-bit Windows 32-bit Linux 64-bit Linux 32-bit macOS
Install command
--> atomsInstall("number")

The goal of this toolbox is to provide several Number theory related
The toolbox is based on macros.
The implementation uses Scilab's double precision integers, 
therefore is limited to integers in the [-2^53,2^53] interval.


 * number_addgroupmod — Returns the additive group modulo m.
 * number_coprime — Checks if two numbers are relatively prime.
 * number_eulertotient — Returns Euler totient function
 * number_extendedeuclid — Solves a linear Diophantine equation (Bezout
 * number_gcd — Greatest common divisor.
 * number_inversemod — Computes the modular multiplicative inverse.
 * number_isdivisor — Checks if a divides b.
 * number_lcm — Least common multiple.
 * number_powermod — Modular exponentiation.
 * number_productmod — Computes a*s modulo m.
 * number_solvelinmod — Solves a linear modular equation.
 * number_ulamspiral — Returns the Ulam spiral.


 * number_barygui — Plots a gui to see the digits of a number.
 * number_baryguiclose — Closes the bary GUI.
 * number_bin2hex — Converts a binary string into a hexadecimal string.
 * number_frombary — Compute a number from a matrix of digits.
 * number_hex2bin — Converts an hexadecimal string into a binary string.
 * number_tobary — Decompose a number into arbitrary basis.


 * number_factor — Factors a number.
 * number_getfactors — Compute the divisors of a number.
 * number_getprimefactors — Factors a number into primes and exponents.
Multiplicative Group

 * number_isprimroot — See if a is a primitive root modulo m.
 * number_multgroupmod — Returns the multiplicative group modulo m.
 * number_multorder — Computes the multiplicative order modulo m.
 * number_searchprimroot — Find a primitive root modulo m.

Prime numbers

 * number_isprime — Checks if a number is prime.
 * number_maximalprimegap — Returns the maximal prime gap.
 * number_multiprimality — Returns the number of prime factors of n.
 * number_primecount — Returns the value of the prime-counting function.
 * number_primes — Computes the list of all primes up to n.
 * number_primes100 — Returns a matrix containing the 100 first primes.
 * number_primes1000 — Returns a matrix containing the 1000 first primes.
 * number_primes10000 — Returns a matrix containing the 10 000 first primes.
 * number_primorial — Returns the product of all primes lower or equal to n
 * number_probableprime — Check if a number is a probable prime.
 * number_pseudoprime — Check if a number is a pseudo prime.

Special Numbers

 * number_carmichael — Returns some Carmichael numbers.
 * number_fermat — Returns the Fermat number 2^2^n + 1
 * number_mersenne — Returns the Mersenne number 2^n - 1
Files (3)
[224.88 kB]
Source code archive

[224.88 kB]
Source code archive

[429.70 kB]
OS-independent binary for Scilab 5.4.x
Binary version
Automatically generated by the ATOMS compilation chain

News (0)
Comments (1)     Leave a comment 
Comment from Michael BAUDIN -- July 16, 2012, 09:35:36 PM    
number (1.3)
    * Added details in the comments of
      number_pseudoprime, number_coprime, number_probableprime
    * Updated demos.
    * Created number_eulertotient.
    * Created number_isprimroot.
    * Created number_searchprimroots.
    * Created number_multgroupmod.
    * Created number_addgroupmod.
    * Renamed number_minimumprimegap into number_maximalprimegap.
    * Created a "Special Numbers" help section.
    * Moved prime-related functions into a new 
      "Prime Numbers" help section.
    * Created number_getfactors.
    * Created number_getprimefactors.
    * Created a "Factorization" help section.
    * Created number_multorder.
    * Created a "Multiplicative Group" help section.
    * Created number_productmod.
    * Changed number_primes1000: now returns a row vector.
    * Extended number_asmodm and number_powermod to 
      negative arguments.
    * Simplified "pollard-rho" method of number_factor to 
      make it closer to the original algorithm.
    * Improved performance of number_powermod, number_asmodm, 
    * Improved performance of number_primitiveroot.
    * Created number_ulamplot.
    * Improved description of number_ulamspiral.
Leave a comment
You must register and log in before leaving a comment.
Login with GitLab
Email notifications
Send me email when this toolbox has changes, new files or a new release.
You must register and log in before setting up notifications.