Skip to content

Properties of a number — even, odd, prime, integer, positive, negative, divisible by a number

What it does: Returns True/False for the selected number property.

Suda

Inputs

  • NUMBER: number to test.
  • (optional) DIVISOR: divisor for "is divisible".

Math operations

Even number

  • A number that can be divided into pairs.
  • Example: 2, 4, 6, 8…
  • When you have 6 candies and you give them away two at a time, there will be none left.

Odd number

  • A number that, when divided into pairs, leaves one extra.
  • Example: 1, 3, 5, 7…
  • When you have 5 candies and you give them away two at a time, one is left.

Prime number

  • A number that can only be divided by itself and one.
  • Example: 2, 3, 5, 7, 11…
  • 6 is no longer a prime number, because it can also be divided into 2×3.

Integer

  • Number without decimal point.
  • Example: -3, 0, 7.

Positive number

  • Number greater than zero.
  • Imagine money in a piggy bank - you have something extra.
  • Example: 1, 2, 10…

Negative number

  • Number less than zero.
  • Imagine a debt - you owe something even though you have nothing.
  • Example: -1, -5, -20…

Divisible by number

  • A number that can be divided without a remainder by another number.
  • Example: 12 is divisible by 3 (12 ÷ 3 = 4, no remainder).
  • 13 is not divisible by 3 (13 ÷ 3 = 4 and 1 remains).

Output

  • boolean

Example

example that checks if the numbers from 1 to 10 are even or odd.

Even and Odd Example

Tips

  • prime only applies to integers ≥ 2.
  • For the option "divisible by a number" and the divisor 0, the generator returns False directly (to avoid modulo zero).