Almost Perfect Number Generator
Generate and search for almost perfect numbers where σ(n) = 2n − 1. Explore powers of 2, verify ranges, and study divisor sum properties.
| # | n | k (if 2k) | σ(n) | 2n − 1 | Divisors |
|---|
About
An almost perfect number is an integer n for which the sum-of-divisors function σ(n) = 2n − 1. Equivalently, the sum of proper divisors falls exactly 1 short of n itself. Every known almost perfect number is a power of 2. Whether a non-power-of-2 almost perfect number exists remains an open problem in number theory. Miscounting divisors or confusing "almost perfect" with "deficient" leads to classification errors in combinatorial and cryptographic applications that rely on divisor function properties.
This tool operates in two modes. The generator mode computes the first N almost perfect numbers directly as 2k values. The range search mode performs brute-force divisor summation across an arbitrary interval [a, b] to independently verify each candidate. For ranges exceeding 100,000 integers, computation is offloaded to a Web Worker. Note: the tool approximates large σ(n) calculations using trial division up to √n. Results for n beyond 253 lose precision due to JavaScript floating-point limits.
Formulas
A positive integer n is almost perfect if the sum-of-divisors function satisfies:
The sum-of-divisors function is computed as:
This equals the sum over all positive divisors d of n. The deficiency of n is defined as:
An almost perfect number has deficiency exactly 1. For powers of 2, the divisor sum follows a geometric series:
Since 2k+1 − 1 = 2 ⋅ 2k − 1, every power of 2 satisfies the condition. The brute-force verification algorithm computes σ(n) by trial division up to √n, yielding O(√n) per candidate.
Where: σ(n) = sum of all positive divisors of n; D(n) = deficiency; k = non-negative integer exponent; d | n means d divides n.
Reference Data
| k | n = 2k | σ(n) | 2n − 1 | Proper Divisor Sum | Deficiency |
|---|---|---|---|---|---|
| 0 | 1 | 1 | 1 | 0 | 1 |
| 1 | 2 | 3 | 3 | 1 | 1 |
| 2 | 4 | 7 | 7 | 3 | 1 |
| 3 | 8 | 15 | 15 | 7 | 1 |
| 4 | 16 | 31 | 31 | 15 | 1 |
| 5 | 32 | 63 | 63 | 31 | 1 |
| 6 | 64 | 127 | 127 | 63 | 1 |
| 7 | 128 | 255 | 255 | 127 | 1 |
| 8 | 256 | 511 | 511 | 255 | 1 |
| 9 | 512 | 1023 | 1023 | 511 | 1 |
| 10 | 1024 | 2047 | 2047 | 1023 | 1 |
| 11 | 2048 | 4095 | 4095 | 2047 | 1 |
| 12 | 4096 | 8191 | 8191 | 4095 | 1 |
| 13 | 8192 | 16383 | 16383 | 8191 | 1 |
| 14 | 16384 | 32767 | 32767 | 16383 | 1 |
| 15 | 32768 | 65535 | 65535 | 32767 | 1 |
| 16 | 65536 | 131071 | 131071 | 65535 | 1 |
| 17 | 131072 | 262143 | 262143 | 131071 | 1 |
| 18 | 262144 | 524287 | 524287 | 262143 | 1 |
| 19 | 524288 | 1048575 | 1048575 | 524287 | 1 |
| 20 | 1048576 | 2097151 | 2097151 | 1048575 | 1 |