Analyze Numbers
Analyze any integer: prime factorization, divisors, digit analysis, number properties, base conversions, Collatz sequence and 30+ mathematical attributes.
About
Misidentifying a number's properties leads to downstream errors in cryptography key selection, hash table sizing, and combinatorial proofs. This tool computes over 30 attributes of any integer: prime factorization, the complete divisor set, aliquot sum classification (perfect, abundant, or deficient), digit-level statistics including digital root and digit frequency, membership tests for sequences like Fibonacci and triangular numbers, and base representations in binary, octal, and hexadecimal. It also generates the full Collatz sequence for n and visualizes its trajectory. All computations run client-side with no server dependency.
The tool handles integers up to approximately 9 ร 1015 with exact arithmetic via JavaScript's BigInt. Primality testing uses trial division up to โn for moderate values and falls back to a deterministic Miller-Rabin variant for larger inputs. Note: factorization of semiprimes above 1012 may take several seconds. Roman numeral output is limited to n โค 3,999,999. Pro tip: use the divisor count to verify Euler's totient calculations, or check the digital root as a fast casting-out-nines sanity check on arithmetic results.
Formulas
The primary factorization algorithm decomposes an integer n into its unique prime factors by trial division with a 6k ยฑ 1 wheel optimization, testing candidates up to โn:
where each pi is a distinct prime and ai โฅ 1 is its multiplicity.
The divisor count ฯ(n) and divisor sum ฯ(n) are derived from the factorization:
Euler's totient function counts integers from 1 to n that are coprime to n:
The digital root is computed without iteration using modular arithmetic:
The Collatz conjecture iterates:
Where n = input integer, pi = i-th prime factor, ai = exponent of pi, ฯ = divisor count function, ฯ = divisor sum function, ฯ = Euler's totient, dr = digital root.
Reference Data
| Property | Definition | Example | Formula / Test |
|---|---|---|---|
| Prime | Divisible only by 1 and itself | 29 | No divisor in 2..โn |
| Composite | Has divisors other than 1 and n | 28 | ยฌ prime โง n > 1 |
| Perfect Number | Equals sum of proper divisors | 28 = 1+2+4+7+14 | ฯ(n) โ n = n |
| Abundant | Sum of proper divisors exceeds n | 12: 1+2+3+4+6 = 16 | ฯ(n) โ n > n |
| Deficient | Sum of proper divisors less than n | 8: 1+2+4 = 7 | ฯ(n) โ n < n |
| Triangular | Sum of first k naturals | 21 = 1+2+โฆ+6 | 8n + 1 is a perfect square |
| Fibonacci | Member of the Fibonacci sequence | 13 | 5n2 ยฑ 4 is a perfect square |
| Palindrome | Reads the same forwards and backwards | 12321 | String reversal equality |
| Armstrong | Sum of digitsk equals n (k = digit count) | 153 = 13+53+33 | โ dik = n |
| Harshad | Divisible by its digit sum | 18 รท 9 = 2 | n mod S(n) = 0 |
| Happy Number | Iterating sum of squared digits reaches 1 | 19 โ 82 โ โฆ โ 1 | Cycle detection (Floyd's) |
| Perfect Square | โn is an integer | 144 = 122 | floor(โn)2 = n |
| Perfect Cube | Cube root of n is an integer | 125 = 53 | round(n1/3)3 = n |
| Even / Odd | Divisibility by 2 | 42 (even) | n mod 2 |
| Digital Root | Iterative digit sum until single digit | 493 โ 16 โ 7 | 1 + (n โ 1) mod 9 |
| Digit Sum | Sum of all digits | 493 โ 16 | โ di |
| Euler's Totient | Count of integers โค n coprime to n | ฯ(12) = 4 | n โ (1 โ 1p) |
| Collatz Length | Steps to reach 1 via Collatz rule | 27 โ 111 steps | Iterative: if even n/2, else 3n+1 |
| Roman Numeral | Standard Roman representation | 2024 โ MMXXIV | Subtractive notation, vinculum for >3999 |
| Binary | Base-2 representation | 42 โ 101010 | n.toString(2) |
| Octal | Base-8 representation | 42 โ 52 | n.toString(8) |
| Hexadecimal | Base-16 representation | 255 โ FF | n.toString(16) |