Home▸Articles▸Physics & Mechanics

Delving into the Secrets of Numbers

Number theory is a branch of mathematics concerned with properties and relationships of integers. It’s often perceived as abstract, but it has profound implications in cryptography, computer science, and even physics. This guide will introduce you to some fundamental concepts.

mysimulator teamUpdated June 2026≈ 5 min read▶ Open the simulation

Prime Numbers

A prime number is a whole number greater than 1 that has only two divisors: 1 and itself. For example, 7 is prime because it’s only divisible by 1 and 7.

The first few prime numbers are 2, 3, 5, 7, 11, and so on. They form a fundamental building block in number theory.

Divisibility Rules

Divisibility rules provide shortcuts for determining if one number is divisible by another. For example, a number is divisible by 2 if its last digit is even.

The divisibility rule for 5 states that a number is divisible by 5 if its last digit is either 0 or 5.

If a % b == 0, then 'b' divides 'a'.
live demo · related simulation● LIVE

The Euclidean Algorithm

The Euclidean algorithm is an efficient method for finding the greatest common divisor (GCD) of two integers. It’s based on repeatedly applying the division algorithm.

Given two integers, a and b, with a > b: 1. Divide a by b and find the remainder r. 2. If r is 0, then GCD(a, b) = b. 3. Otherwise, replace a with b and b with r, and repeat step 1.

GCD(a, b) = GCD(b, a mod b)

Modular Arithmetic

Modular arithmetic deals with remainders after division. We use the modulo operator (%) to find the remainder of a division.

For example, 17 % 5 = 2 because 17 divided by 5 is 3 with a remainder of 2.

a mod b  ≡  (a - kb) mod b , where k is an integer.

Frequently asked questions

What is a composite number?

A composite number is a whole number greater than 1 that has more than two divisors.

Why are prime numbers important?

Prime numbers are the fundamental building blocks of all other integers through their use in factorization.

Can you give an example of using the Euclidean algorithm?

Let's find GCD(48, 18): 1. 48 % 18 = 12. 2. 18 % 12 = 6. 3. 12 % 6 = 0. Therefore, GCD(48, 18) = 6.

Try it live

Everything above runs in your browser — open SPH Fluid and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open SPH Fluid simulation

What did you find?

Add reproduction steps (optional)