WOLFRAM

Divisible[n,m]

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

Details

  • 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.

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Test whether a number is divisible by :

Out[1]=1

The number is not divisible by :

Out[1]=1

Scope  (6)Survey of the scope of standard use cases

Divisible works over integers:

Out[1]=1

Gaussian integers:

Out[4]=4

Rationals:

Out[6]=6

Symbolic forms of numeric quantities:

Out[1]=1

Numeric quantities:

Out[1]=1

Test for large integers:

Out[1]=1

Divisible threads elementwise over lists:

Out[1]=1

TraditionalForm formatting:

Applications  (8)Sample problems that can be solved with this function

Basic Applications  (3)

Highlight numbers divisible by :

Out[1]=1

Generate random numbers divisible by a given number:

Out[2]=2
Out[3]=3

Visualize when one number divides another:

Out[1]=1

Number Theory  (5)

Recognize Wieferich primes, prime numbers p such that divides :

Out[3]=3

There are only two known Wieferich primes:

Out[4]=4

Let be all numbers of the form :

Check that the product of two numbers is still in :

Out[2]=2

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

Find the first Hilbert primes:

Out[4]=4

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

Out[1]=1

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

Out[2]=2
Out[3]=3

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

Out[4]=4
Out[5]=5

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

Out[1]=1
Out[2]=2

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

Out[3]=3
Out[4]=4

is divisible by , where n is an odd integer:

Out[1]=1

Properties & Relations  (7)Properties of the function, and connections to other functions

If is an integer, then is divisible by :

Out[1]=1

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

Out[1]=1
Out[2]=2

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

Out[1]=1
Out[2]=2

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

Out[1]=1
Out[2]=2
Out[3]=3

Use Divisors to find all divisors of an integer:

Out[1]=1
Out[2]=2

PrimeNu gives the number of distinct prime divisors:

Out[1]=1
Out[2]=2

Simplify expressions:

Out[1]=1

Possible Issues  (2)Common pitfalls and unexpected behavior

With symbolic inputs, Divisible stays unevaluated:

Out[1]=1

Divisible does not automatically resolve the value:

Out[1]=1
Out[2]=2

Interactive Examples  (1)Examples with interactive outputs

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

Out[1]=1

Neat Examples  (3)Surprising or curious use cases

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

Out[1]=1

Plot when divides the sum of three squares:

Out[1]=1

Plot the Ulam spiral of numbers divisible by :

Out[2]=2
Wolfram Research (2007), Divisible, Wolfram Language function, https://reference.wolfram.com/language/ref/Divisible.html.
Wolfram Research (2007), Divisible, Wolfram Language function, https://reference.wolfram.com/language/ref/Divisible.html.

Text

Wolfram Research (2007), Divisible, Wolfram Language function, https://reference.wolfram.com/language/ref/Divisible.html.

Wolfram Research (2007), Divisible, Wolfram Language function, https://reference.wolfram.com/language/ref/Divisible.html.

CMS

Wolfram Language. 2007. "Divisible." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Divisible.html.

Wolfram Language. 2007. "Divisible." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Divisible.html.

APA

Wolfram Language. (2007). Divisible. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Divisible.html

Wolfram Language. (2007). Divisible. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Divisible.html

BibTeX

@misc{reference.wolfram_2025_divisible, author="Wolfram Research", title="{Divisible}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Divisible.html}", note=[Accessed: 19-June-2025 ]}

@misc{reference.wolfram_2025_divisible, author="Wolfram Research", title="{Divisible}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/Divisible.html}", note=[Accessed: 19-June-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_divisible, organization={Wolfram Research}, title={Divisible}, year={2007}, url={https://reference.wolfram.com/language/ref/Divisible.html}, note=[Accessed: 19-June-2025 ]}

@online{reference.wolfram_2025_divisible, organization={Wolfram Research}, title={Divisible}, year={2007}, url={https://reference.wolfram.com/language/ref/Divisible.html}, note=[Accessed: 19-June-2025 ]}