![]() |
![]() |
#1 |
Dec 2017
24×3×5 Posts |
![]()
MODERATOR NOTE: Please confine your posts to your blog area.
This is very interesting, because the output is always a Prime number or a Semiprime number. My Python code is very special for all you who thought numerology was a lost cause. I say that the cranks can find something every once in a while. So to all you Grinch's out there don't count me out yet lol. ![]() ![]() Code:
import time while True: p = int(input('Enter a number greater than zero: ')) print('__________________________________________________') n = (((p - 1) % 9 + 1 if p else 0)) s = ((((p+2) - 1) % 9 + 1 if p else 0)) start_time = time.time() print((n*s)-1,'Is this number a Semiprime or Prime Number?') e = int(time.time() - start_time) print('___________________________________________') print('{:02d}:{:02d}:{:02d}'.format(e // 3600, (e % 3600 // 60), e % 60)) Last fiddled with by ONeil on 2020-12-01 at 00:58 Reason: Moderator note |
![]() |
![]() |
![]() |
#2 |
"Dylan"
Mar 2017
3×11×17 Posts |
![]()
Indeed your code does indeed produce a prime or semiprime for any positive input:
I modified your code a bit: Code:
import time p = 1 start_time = time.time() while p <= 1000: n = (((p - 1) % 9 + 1 if p else 0)) s = ((((p+2) - 1) % 9 + 1 if p else 0)) print(p, n, s, (n*s)-1) p += 1 e = int(time.time()-start_time) print('{:02d}:{:02d}:{:02d}'.format(e // 3600, (e % 3600 // 60), e % 60)) Code:
2 7 14 23 34 47 62 7 17 Now, is this a profound result? No, it's not, but it's cool, I guess. |
![]() |
![]() |
![]() |
#3 |
Dec 2017
F016 Posts |
![]()
Thanks Dylan
![]() |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Semiprime and n-almost prime candidate for the k's with algebra for the Sierpinski/Riesel problem | sweety439 | sweety439 | 11 | 2020-09-23 01:42 |
prime generator for f(n)=n^2+1 | bhelmes | Miscellaneous Math | 2 | 2016-03-17 17:50 |
New prime test (or generator) | synergy | Miscellaneous Math | 39 | 2004-09-21 17:10 |
Prime Number Generator | Unregistered | Programming | 6 | 2004-03-21 01:00 |
twin prime generator | 1260 | Math | 13 | 2003-10-12 09:48 |