Overview
The Twin Primes Explorer searches for pairs of prime numbers that differ by exactly 2 (e.g., 11 and 13, 17 and 19). All prime checking is performed using Romasm assembly.
The Twin Prime Conjecture
What is it?
Twin primes are pairs of prime numbers that differ by 2. Examples include:
- (3, 5)
- (11, 13)
- (17, 19)
- (29, 31)
The Twin Prime Conjecture states that there are infinitely many twin prime pairs.
Status: Unproven, but bounded gaps between primes have been proven. The largest known twin primes have over 200,000 digits.
Romasm Implementation
The explorer uses Romasm assembly to check for primality:
; Check if a number is prime (simplified)
; Input: R0 = number to check
; Output: R0 = 1 if prime, 0 if not
LOAD R1, 2 ; Start checking from 2
LOAD R2, 1 ; Constant 1
check_loop:
MUL R3, R1, R1 ; R3 = divisor²
CMP R3, R0 ; Compare with number
JGT is_prime ; If divisor² > number, it's prime
MOD R4, R0, R1 ; R4 = number % divisor
CMP R4, 0 ; Check if divisible
JEQ not_prime ; If divisible, not prime
INC R1 ; Try next divisor
JMP check_loop
is_prime:
LOAD R0, 1 ; Return 1 (prime)
RET
not_prime:
LOAD R0, 0 ; Return 0 (not prime)
RET
BigInt Support
The explorer supports BigInt for searching very large twin prime pairs:
- Can search ranges with hundreds of digits
- Uses efficient prime checking algorithms
- Displays twin pairs as they're found
Using the Explorer
- Enter a starting number (or range)
- Click "Search for Twin Primes"
- View twin prime pairs as they're discovered
- See statistics about the search
Related Documentation
- Big Integer Support - How BigInt works
- Try the Explorer - Open it now!