yields True if n is divisible by m, and yields False if it is not.


  • Divisible is typically used to test whether n is divisible by m.
  • n is divisible by m if n is the product of m by an integer.
  • Divisible[n,m] is effectively equivalent to Mod[n,m]==0.
  • Divisible[n, m] returns False unless n and m are manifestly divisible.
  • Divisible[n,m] can be entered as .
  • can be entered as \[Divides] or divides.


open allclose all

Basic Examples  (2)

Test whether a number is divisible by :

The number is not divisible by :

Scope  (6)

Divisible works over integers:

Gaussian integers:


Symbolic forms of numeric quantities:

Numeric quantities:

Test for large integers:

Divisible threads elementwise over lists:

TraditionalForm formatting:

Applications  (8)

Basic Applications  (3)

Highlight numbers divisible by :

Generate random numbers divisible by a given number:

Visualize when one number divides another:

Number Theory  (5)

Recognize Wieferich primes, prime numbers p such that divides :

There are only two known Wieferich primes:

Let be all numbers of the form :

Check that the product of two numbers is still in :

Recognize Hilbert primes, prime numbers that have no divisors in other than and themself:

Find the first Hilbert primes:

Find two representations of a number as the sum of two squares:

Find a divisor of the number by computing the GCD of and the number:

Find another divisor by computing the GCD of and the number:

An integer is divisible by if the sum of its digits is divisible by :

An integer is divisible by if the alternating sum of the digits is divisible by :

is divisible by , where n is an odd integer:

Properties & Relations  (7)

If is an integer, then is divisible by :

If is divisible by , then the greatest common divisor GCD of them is :

If and are relatively prime, then is not divisible by :

If the prime factorization of an integer has the form , then the number of its divisors is :

Use Divisors to find all divisors of an integer:

PrimeNu gives the number of distinct prime divisors:

Simplify expressions:

Possible Issues  (2)

With symbolic inputs, Divisible stays unevaluated:

Divisible does not automatically resolve the value:

Interactive Examples  (1)

Visualize when the sum of two prime numbers is divisible by a given number:

Neat Examples  (3)

Visualize when is divisible by primes. Each row of dots corresponds to the divisors of , which are labeled along the horizontal axis:

Plot when divides the sum of three squares:

Plot the Ulam spiral of numbers divisible by :

Introduced in 2007