![]() |
![]() |
#1 |
Dec 2017
24·3·5 Posts |
![]()
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)) |
![]() |
![]() |
![]() |
#2 |
Undefined
"The unspeakable one"
Jun 2006
My evil lair
32×23×29 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. |
![]() |
![]() |
![]() |
#3 |
Dec 2017
3608 Posts |
![]() |
![]() |
![]() |
![]() |
#4 |
Dec 2017
24·3·5 Posts |
![]() |
![]() |
![]() |
![]() |
#5 |
Dec 2017
24010 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.
|
![]() |
![]() |
![]() |
#6 | |
"Viliam FurÃk"
Jul 2018
Martin, Slovakia
1010011102 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?? |
|
![]() |
![]() |
![]() |
#7 |
Mar 2019
11·13 Posts |
![]()
What's the point of this code?
If you know Or is it that you know |
![]() |
![]() |
![]() |
#8 | |
Feb 2017
Nowhere
3×7×199 Posts |
![]() Quote:
|
|
![]() |
![]() |
![]() |
#9 |
Jan 2012
Toronto, Canada
1101002 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))
|
![]() |
![]() |
![]() |
#10 | ||
Feb 2017
Nowhere
3·7·199 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? |
||
![]() |
![]() |
![]() |
#11 | |
Undefined
"The unspeakable one"
Jun 2006
My evil lair
32·23·29 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 | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
find very easy twin prime in the infamy twin primes | hal1se | Miscellaneous Math | 13 | 2018-11-05 16:34 |
Mersenne Primes p which are in a set of twin primes is finite? | carpetpool | Miscellaneous Math | 3 | 2017-08-10 13:47 |
Twin Primes | Computer Science & Computational Number Theory | 171 | 2013-05-14 02:57 | |
OT: Twin Primes | R.D. Silverman | Math | 8 | 2005-07-15 21:56 |
Twin primes again | Chris Card | Math | 1 | 2005-05-26 14:18 |