Number 4

Even Composite Positive

four

« 3 5 »

Basic Properties

Value4
In Wordsfour
Absolute Value4
SignPositive (+)
Is EvenYes
Is OddNo
Is PrimeNo
Is CompositeYes
Is Perfect SquareYes (2²)
Is Perfect CubeNo
Is Power of 2Yes
Roman NumeralIV
Square (n²)16
Cube (n³)64
Reciprocal (1/n)0.25

Factors & Divisors

Factors 1 2 4
Number of Divisors3
Sum of Proper Divisors3
Prime Factorization 2 × 2
Factorial (4!)24
Is Perfect NumberNo
Is AbundantNo
Is DeficientYes

Number Theory

Digit Sum4
Digital Root4
Number of Digits1
Is PalindromeYes
Is Armstrong NumberYes
Is Harshad NumberYes
Is Fibonacci NumberNo
Collatz Steps to 12
Goldbach Partition 2 + 2
Next Prime 5
Previous Prime 3

Trigonometric Functions

sin(4)-0.7568024953
cos(4)-0.6536436209
tan(4)1.157821282
arctan(4)1.325817664
sinh(4)27.2899172
cosh(4)27.30823284
tanh(4)0.9993292997

Roots & Logarithms

Square Root2
Cube Root1.587401052
Natural Logarithm (ln)1.386294361
Log Base 100.6020599913
Log Base 22

Number Base Conversions

Binary (Base 2)100
Octal (Base 8)4
Hexadecimal (Base 16)4
Base64NA==

Cryptographic Hashes

MD5a87ff679a2f3e71d9181a67b7542122c
SHA-11b6453892473a467d07372d45eb05abc2031647a
SHA-2564b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a
SHA-512a321d8b405e3ef2604959847b36d171eebebc4a8941dc70a4784935a4fca5d5813de84dfa049f06549aa61b20848c1633ce81b675286ea8fb53db240d831c568

Initialize 4 in Different Programming Languages

LanguageCode
C#int number = 4;
C/C++int number = 4;
Javaint number = 4;
JavaScriptconst number = 4;
TypeScriptconst number: number = 4;
Pythonnumber = 4
Rubynumber = 4
PHP$number = 4;
Govar number int = 4
Rustlet number: i32 = 4;
Swiftlet number = 4
Kotlinval number: Int = 4
Scalaval number: Int = 4
Dartint number = 4;
Rnumber <- 4L
MATLABnumber = 4;
Lualocal number = 4
Perlmy $number = 4;
Haskellnumber :: Int number = 4
Elixirnumber = 4
Clojure(def number 4)
F#let number = 4
Visual BasicDim number As Integer = 4
Pascal/Delphivar number: Integer = 4;
SQLDECLARE @number INT = 4;
Bashnumber=4
PowerShell$number = 4

Fun Facts about 4

  • The number 4 is four.
  • 4 is an even number.
  • 4 is a composite number with 3 divisors.
  • 4 is a perfect square (2² = 4).
  • 4 is a power of 2.
  • 4 is a Harshad number — it is divisible by the sum of its digits (4).
  • 4 is a deficient number — the sum of its proper divisors (3) is less than it.
  • The digit sum of 4 is 4, and its digital root is 4.
  • The prime factorization of 4 is 2 × 2.
  • 4! (factorial) = 24.
  • Starting from 4, the Collatz sequence reaches 1 in 2 steps.
  • 4 can be expressed as the sum of two primes: 2 + 2 (Goldbach's conjecture).
  • In Roman numerals, 4 is written as IV.
  • In binary, 4 is 100.
  • In hexadecimal, 4 is 4.

About the Number 4

Overview

The number 4, spelled out as four, is an even positive integer. In mathematics, every integer has a unique set of properties that define its role in arithmetic, algebra, and number theory. On this page we explore everything there is to know about the number 4 — from its divisibility and prime factorization to its trigonometric values, binary representation, and cryptographic hashes.

Parity and Sign

The number 4 is even, which means it is exactly divisible by 2 with no remainder. Even numbers play a fundamental role in mathematics — they form one of the two basic parity classes and appear in many divisibility rules, algebraic identities, and combinatorial arguments.As a positive number, 4 lies to the right of zero on the number line. Its absolute value is 4.

Primality and Factorization

4 is a composite number, meaning it has divisors other than 1 and itself. Specifically, 4 has 3 divisors: 1, 2, 4. The sum of its proper divisors (all divisors except 4 itself) is 3, which makes 4 a deficient number, since 3 < 4. Most integers are deficient — the sum of their proper divisors falls short of the number itself.

The prime factorization of 4 is 2 × 2. Prime factorization is essential for computing the greatest common divisor (GCD) and least common multiple (LCM), simplifying fractions, and solving problems in modular arithmetic. The nearest primes to 4 are 3 and 5.

Special Classifications

Beyond basic primality, number theorists have identified many special categories that a number can belong to. 4 is a perfect square — it can be expressed as 2². Perfect squares have an odd number of divisors and appear naturally in geometry (areas of squares), the Pythagorean theorem, and quadratic equations. 4 is a power of 2, making it especially important in computer science where binary (base-2) arithmetic underpins all digital computation. Powers of two determine memory sizes, buffer capacities, and hash table dimensions. 4 is a Harshad number (from Sanskrit “joy-giver”) — it is divisible by the sum of its digits (4). Harshad numbers connect divisibility theory with digit-based properties of integers.

Digit Properties

The digits of 4 sum to 4, and its digital root (the single-digit value obtained by repeatedly summing digits) is 4. The number 4 has 1 digit in its decimal representation. Digit sums are fundamental to divisibility tests: a number is divisible by 3 if and only if its digit sum is divisible by 3, and the same holds for divisibility by 9. The digital root, also known as the repeated digital sum, has applications in casting out nines — a centuries-old technique for verifying arithmetic calculations.

Number Base Conversions

In the binary (base-2) number system, 4 is represented as 100. Binary is the language of digital computers — every file, image, video, and program is ultimately stored as a sequence of binary digits (bits). In octal (base-8), 4 is 4, a system historically used in computing because each octal digit corresponds to exactly three binary digits. In hexadecimal (base-16), 4 is 4 — hex is ubiquitous in programming for representing memory addresses, color codes (#FF5733), and byte values.

The Base64 encoding of the string “4” is NA==. Base64 is widely used in web development for encoding binary data in URLs, email attachments (MIME), JSON Web Tokens (JWT), and data URIs in HTML and CSS.

Mathematical Functions

The square of 4 is 16 (i.e. 4²), and its square root is approximately 2.000000. The cube of 4 is 64, and its cube root is approximately 1.587401. The reciprocal (1/4) is 0.25. The factorial of 4 (4!) equals 24. Factorials grow extremely rapidly and are fundamental in combinatorics, probability theory, and Taylor series expansions.

The natural logarithm (ln) of 4 is 1.386294, the base-10 logarithm is 0.602060, and the base-2 logarithm is 2.000000. Logarithms are essential in measuring earthquake magnitudes (Richter scale), sound levels (decibels), acidity (pH), and information content (bits).

Trigonometry

Treating 4 as an angle in radians, the principal trigonometric functions yield: sin(4) = -0.7568024953, cos(4) = -0.6536436209, and tan(4) = 1.157821282. The hyperbolic functions give: sinh(4) = 27.2899172, cosh(4) = 27.30823284, and tanh(4) = 0.9993292997. Trigonometric functions are indispensable in physics (wave motion, oscillations, alternating current), engineering (signal processing, structural analysis), computer graphics (rotations, projections), and navigation (GPS, celestial mechanics).

Cryptographic Hashes

When the string “4” is passed through standard cryptographic hash functions, the results are: MD5: a87ff679a2f3e71d9181a67b7542122c, SHA-1: 1b6453892473a467d07372d45eb05abc2031647a, SHA-256: 4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a, and SHA-512: a321d8b405e3ef2604959847b36d171eebebc4a8941dc70a4784935a4fca5d5813de84dfa049f06549aa61b20848c1633ce81b675286ea8fb53db240d831c568. Cryptographic hashes are one-way functions that produce a fixed-size output from any input. They are used for data integrity verification (detecting file corruption or tampering), password storage (storing hashes instead of plaintext passwords), digital signatures, blockchain technology (Bitcoin uses SHA-256), and content addressing (Git uses SHA-1 to identify objects).

Collatz Conjecture

The Collatz conjecture (also known as the 3n + 1 problem) is one of the most famous unsolved problems in mathematics. Starting from 4 and repeatedly applying the rule — divide by 2 if even, multiply by 3 and add 1 if odd — the sequence reaches 1 in 2 steps. Despite its simplicity, no one has been able to prove that this process always terminates for every starting number, and the conjecture remains open since it was first proposed by Lothar Collatz in 1937.

Goldbach’s Conjecture

According to Goldbach’s conjecture, every even integer greater than 2 can be expressed as the sum of two prime numbers. For 4, one such partition is 2 + 2 = 4. This conjecture, proposed in 1742 by Christian Goldbach in a letter to Leonhard Euler, has been verified computationally for all even numbers up to at least 4 × 1018, but a general proof remains elusive.

Roman Numerals

In the Roman numeral system, 4 is written as IV. Roman numerals originated in ancient Rome and use combinations of letters (I, V, X, L, C, D, M) with subtractive notation for certain values. They remain in use today on clock faces, in book chapters, film sequels, and formal outlines.

Programming

In software development, the number 4 can be represented across dozens of programming languages. For example, in C# you would write int number = 4;, in Python simply number = 4, in JavaScript as const number = 4;, and in Rust as let number: i32 = 4;. Math.Number provides initialization code for 27 programming languages, making it a handy quick-reference for developers working across different technology stacks.

Related Numbers

Nearby Numbers