20201109, 07:25  #1 
Dec 2017
11110000_{2} Posts 
A stab at Twin Primes, Pour on the Steak Sauce
Warning: if you wish to be a prime number theorist, then you
have to realize, as the integers grow the prime gaps increase too! So predicting prime numbers is near impossible at the very large scale! So for most prime number formulas, this one works best at the lower scale. User beware. You must enter a Prime to find the twin prime! I built this twin prime finder for speed so enjoy it kicks ass for speed I mean just check the times and you will scratch your head. Now if you must find your twin prime then input its twin ok on the lower end! It will find the higher integer Twin Prime guaranteed. Also for you seekers out there I built in a modular search for this code and when all zeros come up, check the prime window for at least a prime. For Huge prime who can guarantee it, I'm just saying Code:
print('''Warning: if you wish to be a prime number theorist, then you have to realize, as the integers grow the prime gaps increase too! So predicting prime numbers is near impossible at the very large scale! So for most prime number formulas, this one works best at the lower scale. User beware. You must enter a Prime to find the twin prime!''') import time start_time = time.time() while True: n = int(input("Enter a prime number: ")) if n % 2 != 0: t = (((2*n)//2)) + ((3*(n+2)//3)) ttl = (((2*n)//2)) + ((3*(n+2)//3)) + (((2*n+3)))  ((3*(n+2)//3)) ta = (((2*n)//2)) tb = ((3*(n+2)//3)) print('____________') print(ttl%6,'When all Zero likely twin primes or one prime') print(t%3) print(t%8) print('____________') print(ta,tb,"Prime numbers show here") e = int(time.time()  start_time) print('{:02d}:{:02d}:{:02d}'.format(e // 3600, (e % 3600 // 60), e % 60)) 
20201109, 08:08  #2 
Undefined
"The unspeakable one"
Jun 2006
My evil lair
2×3^{4}×37 Posts 
It might be fast, but it is wrong.
There is no sense in driving at lightning speed when you are driving in the wrong direction. 
20201109, 08:10  #3 
Dec 2017
360_{8} Posts 

20201109, 08:17  #4 
Dec 2017
240_{10} Posts 

20201109, 08:36  #5 
Dec 2017
2^{4}×3×5 Posts 
Your wrong, and here is why the modular arithmetic is great for prediction and helps when its all zero so the approach is to to check when all is zero or 2 zero's and the last is a 4.

20201109, 10:15  #6  
"Viliam FurÃk"
Jul 2018
Martin, Slovakia
2^{3}·41 Posts 
Quote:
If you have to put in the smaller of the two KNOWN twin primes, the only purpose of that code is to print out p+2. Anything more is unnecessary, as is anything less > If you know it's the smaller twin, why even bother printing out p+2?? 

20201109, 11:52  #7 
Mar 2019
11·13 Posts 
What's the point of this code?
If you know prime, it just computes ? (in which case... why not just add 2)? Or is it that you know prime, and it computes *and* tests it for primality? (in which case, why not just use any of the existing primality testing algorithms, which are actually correct?) 
20201109, 13:34  #8  
Feb 2017
Nowhere
1000001000011_{2} Posts 
Quote:


20201113, 03:43  #9 
Jan 2012
Toronto, Canada
2^{2}×13 Posts 
Code:
print('''Warning: if you wish to be a prime number theorist, then you have to realize, as the integers grow the prime gaps increase too! So predicting prime numbers is near impossible at the very large scale! So for most prime number formulas, this one works best at the lower scale. User beware. You must enter a Prime to find the twin prime!''') import time start_time = time.time() while True: n = int(input("Enter a prime number: ")) if n % 2 != 0: t = (((2*n)//2)) + ((3*(n+2)//3)) ttl = (((2*n)//2)) + ((3*(n+2)//3)) + (((2*n+3)))  ((3*(n+2)//3)) ta = (((2*n)//2)) tb = ((3*(n+2)//3)) print('____________') print(ttl%6,'When all Zero likely twin primes or one prime') print(t%3) print(t%8) print('____________') print(ta,tb,"Prime numbers show here") e = int(time.time()  start_time) print('{:02d}:{:02d}:{:02d}'.format(e // 3600, (e % 3600 // 60), e % 60))

20201113, 13:34  #10  
Feb 2017
Nowhere
23×181 Posts 
Quote:
Quote:
If there is any reason for the unnecessary bracketing other than making the code harder to read, I am suffering a failure of imagination as to what it could be. Just out of curiosity, is there a generic term for calculations specifically designed not to do anything? 

20201113, 14:33  #11  
Undefined
"The unspeakable one"
Jun 2006
My evil lair
1011101101010_{2} Posts 
Quote:
So whenever someone says it isn't fast enough, then you just remove one of them and now it is faster. It's pure genius! 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
find very easy twin prime in the infamy twin primes  hal1se  Miscellaneous Math  13  20181105 16:34 
Mersenne Primes p which are in a set of twin primes is finite?  carpetpool  Miscellaneous Math  3  20170810 13:47 
Twin Primes  Computer Science & Computational Number Theory  171  20130514 02:57  
OT: Twin Primes  R.D. Silverman  Math  8  20050715 21:56 
Twin primes again  Chris Card  Math  1  20050526 14:18 